コード例 #1
0
ファイル: analyze.cpp プロジェクト: snoworc/nsfanalyzer
_declspec ( dllexport ) void ATOM_NSFNoteGetInfo(NOTEHANDLE note_handle,
												 WORD note_member,
												 void *value_ptr)
{
	NSFNoteGetInfo(note_handle, note_member, value_ptr);
	return;
}
コード例 #2
0
ファイル: LotusNote.cpp プロジェクト: crespo2014/cpp-lib
void  CLotusNote::GetNoteUNID(UNID* pUID)
{
	memset(pUID,0,sizeof(*pUID));
	if (m_noteid_type > 1) {*pUID = m_note_uid;return;}
	if (m_hnote == NULL) return;
	NSFNoteGetInfo(m_hnote,_NOTE_OID,&m_note_oid);
	m_noteid_type = 3;
	*pUID = m_note_uid;
}
コード例 #3
0
ファイル: LotusNote.cpp プロジェクト: crespo2014/cpp-lib
DWORD CLotusNote::Delete(WORD flags)
{
	DWORD	dwr;
	if ((m_noteid_type != 1) || (m_note_id == 0))
	{
		if (m_hnote == NULL) return Error_Handle("CLotusNote::Delete Note Closed with NoteID invalid");
		NSFNoteGetInfo(m_hnote,_NOTE_ID,&m_note_id);
	}
	Close();
	if (m_db->NoteDelete(m_note_id,flags) != ERR_OK) return SetError(false,ERR_FATAL,"CLotusNote::Delete noteID = <%u> failed because %s",m_note_id,m_db->GetErrorMsg());
	return ERR_OK;
}
コード例 #4
0
ファイル: Message.cpp プロジェクト: killbug2004/WSProf
void Message::InitializeNote()
{
	LOG_WS_FUNCTION_SCOPE();

	DBHANDLE hDB = 0;
	NSFNoteGetInfo(m_noteHandle, _NOTE_DB, &hDB); 

	LNSTATUS status = Session::Instance()->GetNotesSession().GetDatabase(hDB, &m_notesDatabase);
	if(LNNOERROR != status)
	{
		std::vector<char> errorbuffer(LNERROR_MESSAGE_LENGTH);
		LNINT charCount = LNGetErrorMessage(status, &errorbuffer[0]);
		std::string message(errorbuffer.begin(), errorbuffer.begin() + charCount);
		THROW_STD_EXCEPTION(Workshare::Conversions::A22W(message.c_str()).c_str())
	}
コード例 #5
0
ファイル: MimeHandling.c プロジェクト: hackshields/antivirus
/** eus_MimeAtchFileCtnt( ***
Saves the body content of a MIME part as a file attachment to the specified 
Notes document, base64 decoding it if necessary, in the manner Notes itself 
does with MIME body-part attachments.

--- parameters & return ----
pt_CTNT: address of information structure describing the raw MIME part and the 
	type of attachment (and its name) that needs to be accomplished
pt_bufFl: Optional Input & Output. Address of a buffered-file object managed by 
	the LibFileSystem.h module. If input is provided, the raw MIME part is 
	contained within this file, and all content pointers in the pt_CTNT 
	information structure represent relative offsets into the file. Opaque file 
	object will undergo change as a result of this procedure's work. If null, 
	procedure infers that the MIME part resides in a memory buffer, and this 
	input-output parameter is ignored.
h_NOTE: handle to the Notes document to which the file attachment should be made
ppc: Optional Output. Address of pointer variable to receive address of 
	filename associated with the attachment. Caller is responsible for freeing 
	the memory allocated to the string. If null, output is supressed.
RETURN:
	eus_ERR_INVLD_ARG if any input is obviously invalid
	!eus_SUCCESS if a base64 decoding error occurred
	eus_SUCCESS if no error occured
	the Notes API error code otherwise

--- revision history -------
3/14/03 PR: created			*/
STATUS eus_MimeAtchFileCtnt( const MimePrtCtnt *const  pt_CTNT, 
								BufFile *const  pt_bufFl, 
								const NOTEHANDLE  h_NOTE, 
								char * *const  ppc)	{
	const DWORD  ul_LEN_BUF_DFLT = 0x200 * 0x400;
	const WORD  us_LEN_LINE_MAX = 0x50;

	size_t  ui_lenPrt, ui, ui_len = NULL;
	DWORD  ul_lenObj, ul_lenObjBuf;
	char  pc_atchNm[ MAXPATH];
	DBHANDLE  h_db;
	ObjInfo  t_obj;
	HANDLE  h = NULL;
	char * pc, * pc_end;
	long  l, l_, l_end;
	BYTE * puc, * puc_, * puc_end, * puc_bufIn = NULL;
	STATUS  us_err;
	BOOL  f_fail = FALSE;

	if (!( pt_CTNT && pt_CTNT->ui_len && pt_CTNT->puc_ctnt && 
								pt_CTNT->puc_atchNm && pt_CTNT->us_lenAtchNm && 
								pt_CTNT->puc_bdy && h_NOTE))
		return eus_ERR_INVLD_ARG;

	*ppc = NULL;

	//determine the length of the body part and ending coördinate
	if (!( ui_lenPrt = pt_CTNT->ui_len - (pt_CTNT->puc_bdy - 
															pt_CTNT->puc_ctnt)))
		return eus_ERR_INVLD_ARG;

	//Note the encoding involved, if any, and get ahold of the attachment name. 
	//	(Only base64 and no-encoding are currently supported.)
	if (!pt_bufFl)	{
		if (pt_CTNT->puc_encdg && strnicmp( epc_MIM_CTNTENC_B64, 
											pt_CTNT->puc_encdg, 
											eus_LEN_MIM_CTNTENC_B64) != ei_SAME)
			return eus_ERR_INVLD_ARG;
		memcpy( pc_atchNm, pt_CTNT->puc_atchNm, pt_CTNT->us_lenAtchNm);
	}else	{
		if (pt_CTNT->puc_encdg)	{
			if (el_bufFileCpyCtnt( (long) pt_CTNT->puc_encdg, 
											eus_LEN_MIM_CTNTENC_B64, pc_atchNm, 
											pt_bufFl) < eus_LEN_MIM_CTNTENC_B64)
				return !eus_SUCCESS;
			if (strnicmp( epc_MIM_CTNTENC_B64, pc_atchNm, 
											eus_LEN_MIM_CTNTENC_B64) != ei_SAME)
				return eus_ERR_INVLD_ARG;
		}
		if (el_bufFileCpyCtnt( (long) pt_CTNT->puc_atchNm, 
											pt_CTNT->us_lenAtchNm, pc_atchNm, 
											pt_bufFl) < pt_CTNT->us_lenAtchNm)
			return !eus_SUCCESS;
	} //if (!pt_bufFl)
	pc_atchNm[ pt_CTNT->us_lenAtchNm] = NULL;

	//begin a Notes database object of the size ultimately needed
	ul_lenObj = pt_CTNT->puc_encdg ? ui_lenPrt * 3 / 4 : ui_lenPrt;
	NSFNoteGetInfo( h_NOTE, _NOTE_DB, &h_db);
	if (!h_db)
		return eus_ERR_INVLD_ARG;
	if (us_err = eus_PrepObjectWrite( h_db, ul_lenObj, &t_obj))
		return us_err;

	//allocate a Notes memory block for use in populating the database object
	ul_lenObjBuf = ui_lenPrt < ul_LEN_BUF_DFLT ? ui_lenPrt : ul_LEN_BUF_DFLT;
	if (us_err = OSMemAlloc( NULL, ul_lenObjBuf, &h))
		goto errJump;

	//if base64 decoding needs to be done...
	if (pt_bufFl)	{
		l = (long) pt_CTNT->puc_bdy;
		l_end = l + ui_lenPrt;
	}else	{
		puc = pt_CTNT->puc_bdy;
		puc_end = puc + ui_lenPrt;
	}
	if (pt_CTNT->puc_encdg)
		//until all the attachment content has been processed...
		do	{
			BYTE * puc_bufOut;
			size_t  ui_lenOut;

			//set up the Notes-owned buffer
			pc = puc_bufIn = OSLockObject( h);
			pc_end = pc + ul_lenObjBuf;

			//fill a Notes-owned buffer with base64 encoded content, CRLFs 
			//	stripped out...
			do	{
				//locate the end of the current line, append it to the buffer, 
				//	and get in position for next
				if (pt_bufFl)	{
					if (( l_ = el_bufFileSeekStr( epc_CRLF, l, 
													l + us_LEN_LINE_MAX, 
													pt_bufFl)) == ei_FAIL)	{
						us_err = eus_ERR_INVLD_ARG;
						goto errJump;
					}
					ui = l_ - l;
					if (f_fail = el_bufFileCpyCtnt( l, ui, pc, pt_bufFl) < 
																	(int) ui)
						goto errJump;
					l = l_ + eui_LEN_CRLF;
				}else	{
					if (!( puc_ = epc_strInBuf( epc_CRLF, puc, us_LEN_LINE_MAX, 
															eui_LEN_CRLF)))	{
						us_err = eus_ERR_INVLD_ARG;
						goto errJump;
					}
					ui = puc_ - puc;
					memcpy( pc, puc, ui);
					puc = puc_ + eui_LEN_CRLF;
				} //if (pt_bufFl)

				//position on the next-write buffer position
				pc += ui;
			} while (pc < pc_end - us_LEN_LINE_MAX * 3 / 4 && (pt_bufFl ? l < 
														l_end : puc < puc_end));
			*pc = NULL;

			//base64 decode the buffer
			if (f_fail = !f_base64decode( &puc_bufOut, &ui_lenOut, puc_bufIn))
				goto errJump;

			//copy the decoded output back into the Notes buffer and unlock the 
			//	buffer, then write the decoded output to the attachment object
			memcpy( puc_bufIn, puc_bufOut, ui_lenOut);
			free( puc_bufOut);
			OSUnlockObject( h);
			puc_bufIn = NULL;
			if (us_err = eus_AppendToObject( h, ui_lenOut, &t_obj))
				goto errJump;

			//keep track of the total length written to database object
			ui_len += ui_lenOut;
		} while (pt_bufFl ? l < l_end : puc < puc_end);
	//else simply write the part's body content directly into the attachment 
	//	object...
	else
		//until all the attachment content has been processed...
		do	{
			//set up the Notes-owned buffer
			pc = puc_bufIn = OSLockObject( h);
			pc_end = pc + ul_lenObjBuf;

			//fill a Notes-owned buffer with content
			ui = ui_lenPrt - ui_len < ul_lenObjBuf ? ui_lenPrt - ui_len : 
																ul_lenObjBuf;
			if (pt_bufFl)	{
				if (f_fail = el_bufFileCpyCtnt( l, ui, pc, pt_bufFl) < (int) ui)
					goto errJump;
				l += ui;
			}else	{
				memcpy( pc, puc, ui);
				puc += ui;
			} //if (pt_bufFl)

			//write the content to the attachment object
			OSUnlockObject( h);
			puc_bufIn = NULL;
			if (us_err = eus_AppendToObject( h, ui, &t_obj))
				goto errJump;

			//keep track of the total length written to database object
			ui_len += ui;
		} while (pt_bufFl ? l < l_end : puc < puc_end);
		OSMemFree( h);

	//commit the now fully compiled object to the note
	if (us_err = eus_CommitObject( h_NOTE, NULL, pc_atchNm, HOST_MSDOS, NULL, 
																NULL, &t_obj))
		goto errJump;

	//if we're working via a bufferred file, reflow the body part content 
	//	since overwritten
	if (pt_bufFl)
		f_fail = !ef_bufFileSpliceToPrfx( (long) pt_CTNT->puc_ctnt, 
												pt_CTNT->puc_bdy - 
												pt_CTNT->puc_ctnt, pt_bufFl);

	if (ppc && !f_fail)
		if (*ppc = malloc( pt_CTNT->us_lenAtchNm + 1))	{
			memcpy( *ppc, pc_atchNm, pt_CTNT->us_lenAtchNm);
			(*ppc)[ pt_CTNT->us_lenAtchNm] = NULL;
		}else
			us_err = eus_ERR_MEM;

	return us_err + f_fail;

errJump:
	if (h)	{
		if (puc_bufIn)
			OSUnlockObject( h);
		OSMemFree( h);
	}
	eus_releaseObject( &t_obj);

	return us_err + f_fail;
} //eus_MimeAtchFileCtnt(