Problem with REGNewUser function

I’m using C API and traing to register new user by using REGNewUser function.

My example program:

REG_USERNAME_INFO regUserInfo;

regUserInfo.FirstName = "firstname";

regUserInfo.LastName = "lastName";

regUserInfo.OrgUnit = "test";

regUserInfo.ShortName = "ftest";

regUserInfo.AlternateName = "";

regUserInfo.AltLanguage = "PL";

regUserInfo.AltOrgUnit = "";

regUserInfo.MidInitial = "";



REG_MAIL_INFO mailInfo;

mailInfo.pMailFileName = "mail\\test.nsf";

mailInfo.pMailForwardAddress = "";

mailInfo.pMailServerName = "lotusdomino2003/company";

mailInfo.pMailTemplateName = "";

mailInfo.DbQuotaSizeLimit = 1;

mailInfo.MailSystem = 0;



NOTEHANDLE phUserNote;

//DBHANDLE phUserNoteNAB;

error = REGNewUser( hCertCtx, KFM_IDFILE_TYPE_ORGUNIT, “lotusdomino2003/company”,

	&regUserInfo,

	&mailInfo,

	"q1q2w3e4r5t",

	"",

	"C:\\test.id",

	"",

	"test",

	"test@test.com",

	"",

	"",

	fREGCreateIDFileNow | fREGCreateAddrBookEntry | fREGSaveIDInFile | fREGCreateMailFileNow | fREGSaveIDInAddrBook,

	fREGExtEnforceUniqueShortName,

	1,

	&phUserNote,

	NULL,

	NULL,

	NULL,

	NULL,

	NULL

);

If the fREGCreateAddrBookEntry flag is not set everything is OK.

If the fREGCreateAddrBookEntry flag is set user is registered and his ID file

is generated but I get exception - Unhandled exception

at 0x6020d545 in TestLotusCApi.exe: 0xC0000005: Access violation reading location 0xcccccccc.

I do not know why this is happening. Do I something wrong?? Several times I registered user

without exception but I do not know why?