NSFItemInfo Crash

Help! I’m going insane, I’m trying to write an extension manager dll that needs to process a document when it’s being opened.

I’ve registered the call back EM_NSFNOTEOPENEXTENDED and this is working, once i get in it and get the handle to the note if i then try to call NSFItemInfo notes crashes on me… I’ve got to be doing something wrong but i’m stuffed if i can work it out. Here’s the basics of what i’m doing if anyone can see where i’ve stuffed up that would be awesome!

S

case EM_NSFNOTEOPENEXTENDED:

  {

	char far *retCanonicalPathName = malloc (MAXPATH);

	char far *retExpandedPathName =  malloc (MAXPATH);

	char far *port_name= malloc (MAXPATH);

	char far *server_name= malloc (MAXPATH);

	char     file_name[MAXPATH + 1];

	char     MailFileName[MAXPATH + 1];

	BOOL     sResult;

	HANDLE	 hNote;

WORD noteType;

    OID note_oid;

	TIMEDATE lasMod;



	BLOCKID     bidValue;

	WORD        wDataType;

	DWORD		dwValueLen;

ap = pExRecord->Ap;

    hDB = VARARG_GET (ap, HANDLE); /* the db handle*/

	note_id = VARARG_GET (ap, NOTEID); /* the note id*/

	Flags = VARARG_GET (ap, WORD);	/* flags for the note*/

	seqNum = VARARG_GET (ap, WORD);

	pKey = VARARG_GET (ap, BYTE *);

	hNote = VARARG_GET (ap, HANDLE); /* the note */

if (hNote == NULLHANDLE) {

			goto Exit0;

	}

NSFDbPathGet (hDB, retCanonicalPathName, retExpandedPathName);

	OSPathNetParse(retCanonicalPathName, port_name, server_name, file_name);

	sResult = OSGetEnvironmentString(MAIL_MAILFILE_ITEM, MailFileName, MAXUSERNAME);



	/*We only want docs in the mail file, so check it against the ini setting*/

	if (strcmp(MailFileName, file_name)!=0){

		goto Exit0;

	}

	

	sError = NSFDbGetNoteInfo(hDB,

                              note_id,

                              &note_oid,

                              &lasMod,

                              &noteType);

	

	



	if (sError)

	{

		goto Exit0;

	}



	if (noteType == NOTE_CLASS_DOCUMENT) {



	

					sError =  NSFItemInfo(hNote,

				   "Subject",

                   (WORD)strlen("Subject"),

                   NULL, &wDataType, &bidValue , &dwValueLen);

… etc etc the above line is where i crash!

Subject: NSFItemInfo Crash

i can’t see anything wrong here. what’s the value of hNotes when you call NSFItemInfo? Just to make sure there’s not going anything wrong with getting this value.

Markus Seitz

markus.seitz@icodex.com

Subject: RE: NSFItemInfo Crash

Hi Markus

Thanks for the response, um when i print to a log the handle i get this (or something like it

4F7FC70

which looks the same as when i print the handle form another call back i have (I access the MAILSEND callback as well and the getinfo works in that!)

Sean

Subject: NSFItemInfo Crash

Hi Sean,Open this note in your EM (according to known note id) to get the correct note handle.

NSFNoteOpen is allowed in your EM if you use EMCreateRecursionID.

Regards,

Konrad

Subject: RE: NSFItemInfo Crash

OK this worked! thank you soooo much i was on the verge of throwing my computer out the window!

S