Steps for Creating a Sample Parser DLL

This section shows the steps necessary to create a parser. The following example uses the Finger protocol to show the steps.

    To create a parser DLL
  1. Set up your build environment. For this example, build environment requirements are:

    Windows NT

    Microsoft® Visual C++®

    Win32® SDK

  2. Copy the REMAPI files provided in the \MSSDK\SAMPLES\SYSMGMT\SMS\NETMON\REMAPI subdirectory of the Platform SDK CD-ROM.
  3. Rename REMAPI.* to FINGER.*.
  4. Edit FINGER.C and change all references of "RemAPI" to "Finger."
  5. Edit FINGER.H and change all references of "RemAPI" to "Finger."

    Note FINGER.H is where you make your data structures within the #pragma pack(1) lines. You need this pragma because you will get DWORD aligned unless you tell the compiler to pack.

  6. Edit the makefile and change all references of "RemAPI" to "Finger."
  7. Edit the FINGER.DEF file and change all references of "RemAPI" to "Finger."
  8. Save all files and do an NMAKE. Your output should look like this:
    F:\BH\PARSERS\finger>nmake                                          
                                                                        
    Microsoft (R) Program Maintenance Utility   Version 1.50.4048       
    Copyright (c) Microsoft Corp 1988-93. All rights reserved.          
                                                                        
            cl386 -c -G3 -Gs -W3 -nologo -Zl -Z7 -Od -D_X86_=1 -DDEBUG 
            -DMSINTERNAL -DDEBUG -D_DLL -If:\bh\include -nologo 
            Finger.c
    g:\msvcnt\bin\CL386.EXE: warning: invoking g:\msvcnt\bin\CL.EXE     
    Finger.c                                                            
            lib32 -subsystem:WINDOWS -machine:i386 -def:Finger.def 
            Finger.obj -out:Finger.lib                                  
    g:\msvcnt\bin\LIB32.EXE: warning: invoking g:\msvcnt\bin\LIB.EXE    
    Microsoft (R) 32-Bit Library Manager Version 1.00                   
    Copyright (C) Microsoft Corp 1992-93. All rights reserved.          
                                                                        
       Creating library Finger.lib and object Finger.exp ...            
            link32 -subsystem:WINDOWS -machine:i386 -align:0x1000 
            -MAP:Finger.map -debug:full -debugtype:both 
            -entry:DLLEntry@12 -dll -out:Finger.dll -map:Finger.map 
            Finger.exp Finger.obj kernel32.lib user32.lib crtdll.lib 
            f:\bh\build\parser.lib f:\bh\build\BHSUPP.lib 
            f:\bh\build\NMAPI.lib                        
    Microsoft (R) 32-Bit Executable Linker Version 2.50.4048 (NT)       
    Copyright (C) Microsoft Corp 1992-94. All rights reserved.          
                                                                        
            mapsympe -nologo -n -o Finger.sym Finger.dll > nul          
            copy Finger.sym f:\bh\build\parsers                         
            1 file(s) copied.                                           
            copy Finger.dll f:\bh\build\parsers                         
            1 file(s) copied.                                           
            copy Finger.lib f:\bh\build\parsers                         
            1 file(s) copied.                                           
            copy Finger.ini f:\bh\build\parsers                         
    The system cannot find the file specified.                          
    NMAKE : fatal error U1077: 'D:\WINNT\system32\cmd.exe' : return code'0x1'      
    Stop.                                                               
     
  9. The last error is expected because there is no FINGER.INI file. To avoid this error, remove the COPY statement from the makefile.
  10. Fix any errors in the build. It should compile without errors at this point.
  11. Add your parser to the Network Monitor. See Installing Your Protocol Parser DLL to the Network Monitor.