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,
¬e_oid,
&lasMod,
¬eType);
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!