Are you a world traveler? ZoneTick is a cool utility that'll help you stay in touch over multiple time zones!
 
CFGCODE  
Nik Okuntseff  MS Exchange Server Programming 

CFGCODE

An original, interesting and useful sample tool that comes with EDK is CFGCODE. General idea behind it is that having MAPI properties listed in some initialization file, you can exercise the tool and get all properties chained one after another in one contiguous blob (a file). Thus, your collection of properties in no longer an array of SPropValues with pointers to random locations, but a self contained, self relative piece of data. You can copy this block without a risk of loosing anything. This technique is often used with Exchange Administrator extension DLLs, when you store MAPI properties for your extension object in such a file. Apparently, the sample got its name from this fact. However, the potential use for it seems to be a bit more generic.

The CFGCODE sample is related to HrCfgPackData and HrCfgUnpackData. You may use it to prepare a data file from an easy to understand INI file as explained below, and then use the HrCfgUnpackData to obtain a regular collection of MAPI properties.

Contrary to Address Book and Message Store Viewers the CFGCODE is not ready to use. You need to build it. The source is located under Mssdk\samples\dbmsg\exchange\cfgcode. One interesting feature (a bug) of it is that it can't be built if the root directory is renamed from default Mssdk to something else.

Once you have the CFGCODE sample compiled you can exercise it with the following command:

CFGCODE /?

It would be a good idea to read the MSDN Library article named "CFGCODE: Generated a Packed Property Structure" where Microsoft explains some of its features.
 

Input File Format for CFGCODE

CFGCODE works only with 5 property types: PT_LONG, PT_BOOLEAN, PT_SYSTIME, PT_STRING8 and PT_BINARY. This means that you can't use it for conversion of multivalued properties such as string arrays. However, you can define sections in the input file and specify section name as one of the parameters to the program. This will convert only properties defined under this section and ignore all other sections. Here is the sample INI file:

;
; Sample INI file for CfgCode.Exe
;

[MySection]
0fff0102=01 23 45 67 89 ab cd ef
0005000b=1
00090003=255
3001001e=Accounting
30080040=1996/02/26 13:28:47

[AnotherSection]
0fff0102=fe dc ba 98 76 54 32 10
0005000b=1
00090003=255
3001001e=Marketing
30080040=1996/02/26 13:28:50
 
 

Usage of CFGCODE

If you execute CFGCODE /? command you would normally see the following self explanatory screen:

Utility to create a packed configuration data from a .INI file.

USAGE: CFGCODE InFile OutFile [Flags]

    InFile            Input .INI file containing MAPI properties
    OutFile         Output file to write packed configuration data
    /SECTION   Name of the [Section] in the .INI file
    /NAME=      Configuration name for packed data
    /HELP or /?  Display help screen
 

The following command:

CFGCODE MyInput.INI MyOutput.DAT /SECTION=MySection /NAME=MyName

will pack MAPI properties from MySection of your MyInput.INI file into MyOutput.DAT file. You may wish to examine its contents with a binary editor in order to see how properties are packed. Although it may seem that section and name flags are optional, in fact they are not. The CFGCODE program is also able to log errors to Windows NT application log. When I executed the program against a non existing .INI file it logged an event describing the error condition.
 

[ Contents | Home ]

Send comments and suggestions to niko@wrconsulting.com
Copyright © 1997-1998 by Nik Okuntseff