3GL   4GL   5GL  

,

  1. TraceSrv
  2. TraceSrvn DCOMCNFG
  3. TraceSrv
  4. Trace View
  5. TraceSrv

, , , , , . , - Microsoft Visual Basic, Scripting Edition (VBScript), Active Server Pages, Web- , , . , , , , VBScript- C++. .

TraceSrv, , , , . , , , , , , .

TraceSrv . , . , , . , , .

 

TraceSrv

TraceSrv, , . :

1. TraceSrv , , , C++, Visual Basic, Borland Delphi, Visual Basic for Applications, Java, Jscript VBScript.

2. TraceSrv .

3. TraceSrv , .

4. , , ().

5. (trace viewer applications) .

6. () :

( ) ;

;

(ID) , ;

, ;

, TraceSrv.

7. TraceSrv, . 6 , , ( ) .

, TraceSrv - . , (DLL), . , Web-, VBScript Java. , VBScript , - VBScript DLL. , ,

, , VBScript createObject; -, a VBScript . - , TraceSrv -.

- . - +, " ", +- Microsoft Win32. , - .

+- ( DCOM2) - Microsoft Windows NT 4 . ( ), - ( ). , +- (ATL3), Microsoft Visual C++ 6 , .

, TraceSrv. TraceSrv (itrace) IDL-4TRACESRV.IDL, 11-1. TraceSrv Trace iTrace, , BSTR (. bstrText ).

COM+ () Microsoft (MTS Microsoft Transaction Server). .

DCOM (Distributed Component Object Model) . .

3ATL ActiveX Template Library. .

IDL- , ATL -. ( ) -, . IDL- C++. .

 

11-1.TRACERV.IDL

 /*- - - - - - - - - - - - - - - - - - - - - - - - - - 

"Debugging Applications" (Microsoft Press)

Copyright (c) 1997-2000 John Robbins All rights reserved.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

 

import "oaidl.idl";

 import "ocidl.idl"; 

[

object ,

uuid ( 4D42AOOC-7774-11D3-9F57-OOC04FA34F2C ) ,

 dual ,

helpstring ( "ITrace Interface" ) , 

pointer_default ( unique ) 

]

interface ITrace : IDispatch 

{

[ id ( 1 ) ,

helpstring ( "method Trace" ) ]

HRESULT Trace ( [ in ] BSTR bstrText ) ;

 [ id ( 2 ) ,

helpstring ( "method FullTrace" ) ]

HRESULT FullTrace ( [ in ] BSTR bstrText , [ in ] long dwPID ) ;

 [ propget, id ( 3 ) ,

helpstring ( "property ShowTimeStamps" ) ]

HRESULT ShowTimeStamps ( [ out, retval ] VARIANT_BOOL *pVal ) ;

 [ propput, id ( 3 ) ,

helpstring ( "property ShowTimeStamps" ) ]

HRESULT ShowTimeStamps ( [ in ] VARIANT_BOOL newVal ) ; 

[ propget,

id ( 4 ) ,

helpstring ( "property ShowTraceAsODS" ) ]

HRESULT ShowTraceAsODS ( [ out, retval ] VARIANT_BOOL *pVal ) ; 

[ propput,

id ( 4 ) ,

helpstring ( "property ShowTraceAsODS" ) ]

HRESULT ShowTraceAsODS ( [ in ] VARIANT_BOOL newVal ) ;

 [ propget,

id ( 5 ) ,

helpstring ( "property ShowItemNumber" ) ]

HRESULT ShowItemNumber ( [ out, retval ] VARIANT_BOOL *pVal ) ; 

[ propput,

id ( 5 ) ,

helpstring ( "property ShowItemNumber" ) ]

HRESULT ShowItemNumber ( [ in ] VARIANT_BOOL newVal ) ;

 [ propget,

id ( 6 ) ,

helpstring ( "property ShowPID" ). ]

HRESULT ShowPID ( [ out, retval ] VARIANT_BOOL *pVal ) ; 

[ propput,

id ( 6 ) ,

helpstring ( "property ShowPID" ) ]

 HRESULT ShowPID ( [ in ] VARIANTJ30OL newVal ) ;

 [ propget,

 id ( 7 ) ,

helpstring ( "property AddCRLF" ) ]

HRESULT AddCRLF ( [ out, retval ] VARIANT_BOOL *pVal ) ;

 [ propput, 

id ( 7 ) ,

helpstring ( "property AddCRLF" ) ]

 HRESULT AddCRLF ( [ in ] VARIANT_BOOL newVal ) ;

 } ;

 [

uuid ( 4D42AOOO-7774-11D3-9F57-OOC04FA34F2C ) ,

 version ( 1.0 ) ,

helpstring ( "TraceSrv 1.0 Type Library" ) ]

library TRACESRVLib 

{

importlib ( "stdole32.tlb" ) ;

 importlib ( "stdole2.tlb" ) ; 

[

uuid ( 4D42AOOE-7774-11D3-9F57-OOC04FA34F2C ) ,

 helpstring ( "_ITraceEvents Interface" ) 

]

dispinterface _ITraceEvents 

{

properties: methods: 

[ id ( 1 ) ,

helpstring ( "method TraceEvent" ) ] HRESULT TraceEvent ( BSTR bstrText ) ; 

[ id ( 2 ) ,

helpstring ( "method ChangeShowTimeStamps" ) ]

 HRESULT ChangeShowTimeStamps ( VARIANT_BOOL bNewVal ) ;

 [ id ( 3 ) ,

helpstring ( "method ChangeShowTraceAsODS" ) ]

 HRESULT ChangeShowTraceAsODS ( VARIANT_BOOL bNewVal ) ;

 [ id ( 4 ) ,

helpstring ( "method ChangeShowItemNumber" ) ] 

HRESULT ChangeShowItemNumber ( VARIANT_BOOL bNewVal ) ; 

[ id ( 5 ) ,

helpstring ( "method ChangeShowPID" ) ] 

HRESULT ChangeShowPID ( VARIANT_BOOL bNewVal ) ; 

 [ id ( 6 ) ,

helpstring ( "method ChangeAddCRLF" ) }

HRESULT ChangeAddCRLF ( VARIANT__BOOL bNewVal ) ;

 } ; 

[

uuid ( 4D42AOOD-7774-11D3-9F57-OOC04FA34F2C ) , 

helpstring ( "Trace Class" ) 

]

coclass Trace 

{

[ default ] interface ITrace ;

[ default, source ] dispinterface _ITraceEvents ; 

} ; 

} ;

, iTraceEvents. ITrace 1TraceSrv, ( . 6 ) ( , , TraceSrv, ). TraceSrv , , TraceView. ( ) , , TraceSrv.

AppWizard ( - ATL) 90% +-. TraceSrv . TraceSrvTRACE.H TRACE.CPP -. , , . CTr: :ProcessTrace ( ) 11-2.

, propput propget IDL- ( Visual Basic), , . .

11-2.   CTr: :ProcessTrace

HRESULT CTrace :: ProcessTrace ( BSTR bstrText , long dwPID) 

{

// !

ASSERT ( this ) ;

ASSERT ( NULL != bstrText ) ; 

// . ,

// .

int ilnputLen = 0 ; 

if ( NULL == bstrText ) 

{

return ( Error ( IDS_NULLSTRINGPASSED , 

 GUID_NULL ,

 E_INVALIDARG ) ) ;

 }

// bstrText .

// , . 

ASSERT ( FALSE = IsBadReadPtr ( bstrText , sizeof ( BSTR ) ) ) ; 

ASSERT ( L';\0'; != *bstrText ); 

if ( ( TRUE == IsBadReadPtr ( bstrText , sizeof ( BSTR ) ) ) ||

( L';\0'; == *bstrText ) ) 

{

return ( Error ( IDS_INVALIDSTRING , GUID_NULL

E_INVALIDARG ) ) ; 

}

// , ,  

// ( ).

 iInputLen = IstrlenW ( bstrText ) ;

// ,

 // . 

UINT uiSize = ( ilnputLen * sizeof ( OLECHAR ) ) +

k_SIZE_FULLFORMATBYTES ;

// lock, m_cOutput.

 // Grab the lock to protect the m_cOutput class.

 ObjectLock lock ( this ) ;

 // ProcessTrace (m_lBuffSize - 0), 

// if- ,

 if ( uiSize >= m_cOutput.BufferSize ( ) ) 

{

// .

 m_cOutput.Free ( ) ;

// ,

. // ,

 // .

 // .

 // 2 ,

 // .

 // Unicode, // . 

UINT uiAllocSize = uiSize * 2 ;

// , . 

// 2 ,  

// if- .

if ( k_MIN_TRACE_BUFF_SIZE > uiAllocSize ) 

{

uiAllocSize = k_MIN_TRACE_BUFF_SIZE ;

 }

OLECHAR * pTemp = m_cOutput.Allocate ( uiAllocSize ) ;

 ASSERT ( NULL != pTemp ) ;

 if ( NULL == pTemp ) 

{

return ( Error ( IDSJXJTOFMEMORY ,

 GUID_NULL , EJDUTOFMEMORY ) ) ;

 }

}

// , .

 // 1 .

 m_dwCurrCount++ ; 

if ( 100000 == m_dwCurrCount )

 {

m_dwCurrCount = 0 ;

 }

//  

OLECHAR * pCurr = m__cOutput.GetDataBuffer ( ) ;

 if ( -1 = m_vbShowItemNumber ) 

{

pCurr += wsprintfW ( pCurr , L"%05d " , m_dwCurrCount ) ;

 }

if ( -1 == m_vbShowTimeStamps ) 

{

// .

 // ( , !).

 // 24- .

int iLen = GetTimeFormatW ( LOCALE_USER_DEFAULT ,

LOCALE_NOUSEROVERRIDE |

TIME_FORCE24HOURFORMAT |

TIME_NOTIMEMARKER , 

NULL

NULL , 

pCurr ,

 k_SIZE_TIME ) ; ASSERT ( 0 != iLen ) ;

// ,

 // NULL- . 

pCurr 4= ( iLen - I ) ;

11 GetTimeFormat ,

 // .

*pCurr = L' ' ;

pCurr++ ;

 }

if ( -1 == m_vbShowPID )

 {

pCurr += wsprintfW ( pCurr , L"[%04X] " , dwPID ) ; 

}

//

 // NULL- .

 IstrcpynW ( pCurr , bstrText , IlnputLeri + 1 ) ;

 // pCurr, NULL-.

 pCurr += ilnputLen ;

// , CRLF , 

if ( -1 == m_vbAddCRLF ) 

{

if ( ( L';\xOD'; != *( pCurr _ 2 ) ) || 

( L';\xOA'; != *( pCurr _ 1 ) ) )

{

*( pCurr ) = L';\xOD;;

*( pCurr + 1 } = L';\xOA'; ;

 pCurr += 2 ;

*pCurr = YL';\0'; ;

}

// ?

 if ( -1 == m_vbShowTraceAsODS )

 {

OutputDebugStringW ( (OLECHAR*) m_cOutput ) ; 

}

// . 

m_cOutput.GetStringByteLength ( ) ;

 // .

#ifdef _DEBUG

HRESULT hr =

#endif

Fire_TraceEvent ( m_cOutput ) ;

 #ifdef _DEBUG

if ( ! SUCCEEDED ('hr ) ) 

{

ASSERT ( SUCCEEDED ( hr ) ) ;

TRACE ( ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ) ) ; 

TRACE ( _T ( "TraceSrv FireJTraceEvent failed!!\n" ) ) ;

 TRACE ( ( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" ) ) ; 

}

#endif

return ( S_OK ) ; 

}

, TraceSvr . Implement Connection Point ClassView IconnectionPoint . ATL Proxy Generator Microsoft Visual C++ 5, .

BSTR . , , , .   : : ProcessTrace TRACE.CPP , , TraceSrv. CComBSTR. , Sysxxxstring. ccomBSTR , ( TraceSrv), , .

, CFastBSTR, BSTR . FASTBSTR.H. (DWORD) GetstringByteLength. , BSTR, , . , CFastBSTR , Sysxxxstring.

: (debug) (release) , Unicode. TraceSrv Windows 98. 5, Windows 2000, , Unicode. TraceSrv Windows 2000, Windows 98, , , Unicode-.

, TraceSrv, TraceSrv. , Visual C++ 6, -, COM AppWizard (ATL), TraceSrv. TraceSrv ATL-, TraceSrv -. TraceSrv Win32, -service. , , Win32 ( SoftICE) . , "--", (. . ) net stop tracesrv , . , TraceSrv , .

 

TraceSrv DCOMCNFG

TraceSrv , , (. . TraceSrv +-). , , TraceSrv , , . , , TraceSrv . - , ( -). Visual Basic- "" Visual C++. , "" . , , VB-, , TraceSvr , VB-.

TraceSrv , DCOMCNFG.EXE, . , +- . +- +- . , , . 11.1 , , TraceSrv.

11.1. DCOMCNFG

Default Properties DCOMCNFG

Enable Distributed COM () 

On This Computer

Default Authentication Level Connect

Default Impersonation Level Identify

Default Security DCOMCNFG.EXE

Default Access Permissions     Everyone (Bee)        Allow Access ( )

                                                  INTERACTIVE              Allow Access 

                                                 NETWORK                   Allow Access 

                                                 SYSTEM                       Allow Access

Default Launch Permissions       Administrators                    Allow Launch 

                                                     ()           ( )

                                                          Everyone                      Allow Launch

                                                        INTERACTIVE              Allow Launch

                                                         NETWORK                  Allow Launch 

                                                        SYSTEM                      Allow Launch

Default Configuration                  Administrators     Full Control Permissions 

                                                                                 ( )

                                                  CREATOR            OWNER Full Control 

                                                  Everyone               Read ()

                                                 INTERACTIVE    Special Access ( 

                                                                              .  

                                                                               Create Link, 

                                                                              Write DAC Write Owner)

                                                  SYSTEM              Full Control

TraceSrv ( , -RegServer ) DCOMCNFG, TraceSrv ( Trace Class Windows 98) Properties. Location. TraceSrv , Run Application On This Computer . TraceSrv , Run Application On The Following Computer . ( , DCOMCNFG , .) , , Security .

- DCOMCNFG (security) (identity), TraceSrv , -unRegServer , TraceSrv (. ). (registration) "" (unregistration) ATL.

, , TraceSrv, , , , . , , TraceSrv, .

 

TraceSrv

, TraceSrv, . , TraceSrv. , , , TraceSrv, iirace, .

, , . , iciassFactory:: Createinstance itrace. Createinstance, , , . , ATL, ccomciassFactorySingieton, , , , . DECLARE_CLASSFACTORY_SINGLETON (CTrace), TRACE.H. , ATL.

, TraceSrv, , ccomBSTR . CFastBSTR, , . ( CTrace: :ProcessTrace), 11-2. TraceSrv ASSERT, 3, - TraceSrv , setoiagAssertoptions .

, TraceSrv . Fire_TraceEvent, Implement Connection Point IDE, - . Fire_TraceEvent 11-3. .

11-3. Fire_ TraceEvent

HRESULT Fire_TraceEvent( BSTR bstrText ) 

{

CComVariant varResult;

* = static_cast<T*>( this );

int nConnectionlndex;

CComVariant* pvars = new CComVariant[1];

int nConnections = m_vec.GetSize( );

for ( nConnectionlndex = 0;

nConnectionlndex < nConnections; nConnection!ndex++ ) 

{

pT->Lock();

CComPtr<IUnknown> sp = m_vec.GetAt( nConnectionlndex );

pT->Unlock( );

IDispatch* pDispatch = reinterpret_cast<IDispatch*>( sp.p );

if (pDispatch != NULL)

{

VariantClear( SvarResult );

pvars[0] = bstrText;

DISPPARAMS disp = { pvars, NULL, 1, 0 };

pDispatch->Invoke( 0xl,

IID_NULL,

LOCALE_USER_DEFAULT, 

DISPATCH_METHOD,

 &disp, SvarResult, 

NULL, NULL ); 

}

delete[] pvars; 

return varResult.scode; 

}

, , TraceSrv . Fire_rraceEvent, , for , . varResuit.scode, for. , , . Fire_rraceEvent (-, /GZ ).

. , Implement Connection Point, (TRACESRVCP.H) CORRECTEDTRACESRVCP.H varResult varResuit.scode s . , , , Visual C++ IDispatch:: invoke. Visual C++ . , TraceSrv .

, TraceView, Win32, TraceSrv .

 

TraceView

TraceSrv , , , . TraceView Visual Basic, . , , .

TraceView , , , , , , , . , . , , LoadResStrings ( LoadFormResStrings) , , . TraceView . TraceView TraceSrv . TraceView TraceSrv , Trace View TraceSrv , . TraceView TraceSrv, TraceSrv , +-. TraceView TraceSrv, +-, , VB- "Run-time error -2147023071 (80070721) Automation Error" ( -2147023071 (80070721) ). WINERROR.H (ID) : RPC_S_SEC_PKG_ERROR, "A ' security package specific error occurred" ( ).

, MSDN, , WINERROR.H . , , VB- TraceSrv , Trace- withEvents. withEvents, RPC_S_SEC_PKG_ERROR , , (security) TraceSrv.

" " , , - . withEvents iconnectionPoint, , , . , . TraceSrv , TraceView, , , , TraceSrv , TraceView. TraceSrv +-, a TraceView , , . , Windows NT Workstation , "John" . Q158508 Knowledge Base (" -") Windows NT Workstation " ". , Windows NT Workstation, ASCII-, , DCOM NT (, ) , ".

, "Bob", TraceSrv , TraceView , , "John", RPC_S_SEC_PKG_ERROR. TraceSrv - I . 

: , . Win32 . , TraceSrv , - iconnectionPoint, . , +- , . CoInitializeSecurity, , Coinitiaiize TraceView, Visual Basic, CoInitializeSecurity . CoInitializeSecurity sub Main, 0x80010119 (RPC_E_ TOO_LATE), : "Security must be initialized before any interfaces are marshaled or unmarshaled. It cannot be changed once initialized." ( 1 . .) , Visual Basic , . 

. . .

Visual Basic . 1 DCOMCNFG Default Authentication Level I Default Properties None. , . : , TraceSrv, , , Services. TraceSrv ( ) Start Service, Properties, Properties TraceSrv. Log On Log On As This Account , TraceSrv. . "COM Security Frequently Asked Questions" ( -): " Localsystem ... NT, , , DCOM RPC1-". , , TraceView . , , TraceSrv. , Build, (build) .

 

TraceSrv

TraceSrv . - TraceSrv , . 11-4 TraceSrv VBScript, , TraceSrv. C++ , TraceSrv, BSTR. DCOMTEST.CPP 11-5.

 RFC Remote Procedure Call, ( , ; - ; , DCOM, CORBA, Java RMI.

  11-4. TraceSrv VBScript 

<SCRIPT LANGUAGE="VBScript"><!- -

Dim g_TraceObj

set g_TraceObj = CreateObject ( "TraceSrv.Trace.1" )

g_TraceObj.Trace( "This is a test of the...?" + vbCRLF )

Sub ButtonOne_OnClick

g_TraceObj.Trace ( "Hey! I'm Button One!" + vbCRLF )

 End Sub 

Sub ButtonTwo__OnClick

g_TraceObj.Trace ( "VBScript is dangerous!" + vbCRLF )

 End Sub

 - -></SCRIPT>

 

11-5. TraceSrv C++ (DCOMtESf .)

void main ( void ) 

{

HRESULT hr ;

ITrace * IpTrace ;

lUnknown * IpUnknown ;

// +.

hr = CoInitializeEx ( NULL , COINIT_APARTMENTTHREADED ) ;

if ( FAILED ( hr ) )

{

printf ( "Unable to initialize COM+\n" ) ; 

return ; 

}

hr = CoCreatelnstance ( CLSIDJTrace ,

NULL , CLSCTX_SERVER , IID_IUnknown , (LPVOID*)SlpUnknown } ;

 if ( FAILED ( hr ) ) 

{

LPVOID IpMsgBuf;

FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |

 FORMAT_MESSAGE__FROM_SYSTEM |

  FORMAT_MESSAGE_IGNORE__INSERTS, 

NULL,

  hr,

MAKELANGID ( LANG_NEUTRAL, SUBLANG__DEFAULT ), 

(LPTSTR) SlpMsgBuf, 

0,

NULL ) ;

printf ( "CoCreatelnstanceEx failed: Ox%08X\n" , hr ) ;

 printf ( "FormatMessage returned: %s\n" , IpMsgBuf ) ;

 return ; 

}

 hr = lpUnknown->Query!nterface ( IID_ITrace ,

(LPVOID*)&lpTrace ) ; 

lpUnknown->Release ( ) ;

 if ( FAILED ( hr } )

 {

LPVOID IpMsgBuf;

FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |

 FORMAT_MESSAGE_FROM_SYSTEM |

  FORMAT_MESSAGE_IGNORE_INSERTS, NULL,

hr,

MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ),

 (LPTSTR) SlpMsgBuf, 0,

NULL );

printf ( "Querylnterface failed: Ox%08X\n" , hr ) ; 

printf { "FormatMessage returned: %s\n" , IpMsgBuf ) ;

 return ; 

}

OLECHAR * pszTemp ;

pszTemp = SysAllocString ( OLESTR ( "Hello from a C++ program!!!" ) ); ,

 lpTrace->Trace ( pszTemp ) ; 

SysFreeString ( pszTemp ) ;

 lpTrace->Release ( ) ;

 CoUninitialize ( ) ; 

}

 

TraceSrv, , , . TraceSrv , TraceSrv , Windows 2000. -, . , - , , , . /, , , , .

TraceSrv . .

        3GL   4GL   5GL  

, - - :
- - ;
- (obj) (dll).




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution