Click here to Skip to main content
15,897,187 members
Articles / Productivity Apps and Services / Microsoft Office

Hiding and Storing/caching of Application Specific data in MS Word 2003 documents

Rate me:
Please Sign up or sign in to vote.
3.54/5 (8 votes)
9 Oct 2008CPOL8 min read 29.1K   512   18  
Proof of concept on how the application specific (small/large amount of) data can be stored in ms word document as well as how it can be made hidden from end user’s eye.
// FileStorage.h : main header file for the FileStorage DLL
//

#pragma once

#ifndef __AFXWIN_H__
	#error "include 'stdafx.h' before including this file for PCH"
#endif

#include "resource.h"		// main symbols


// CFileStorageApp
// See FileStorage.cpp for the implementation of this class

#define	MAX_RETRY						50
#define STRINGDATA_DOCUMENTID			100
#define Error_OpenFile					1000

WCHAR StorageName_DataStorage[12]        = L"DataStorage";
WCHAR StreamName_DocumentID[32]		= L"DocumentID";
	
//

class CFileStorageApp : public CWinApp
{
public:
	CFileStorageApp();
	BOOLEAN AddDataToFile(WCHAR *pwszFileName, int typeOfData,WCHAR * data,BOOLEAN officeFile );
	HRESULT AddToStorage(WCHAR *pwszFileName,WCHAR* pwszData,WCHAR *pwszStreamName,int *errorcode );
	HRESULT CreateStream(IStorage* pDataSpaceStorage,	IStream**	pStream, WCHAR *pwszStreamName);
	HRESULT WriteToStream(IStream* pStream, void* pData, int nDataSize);

	BOOLEAN ReadDataFromFile(WCHAR *pwszFileName,  int typeOfData,WCHAR* data,ULONG ulDataSize,BOOLEAN officeFile );
	HRESULT GetFromStorage(WCHAR *pwszFileName,void * pBuff,ULONG ulDataSize,WCHAR *pwszStreamName );
	HRESULT ReadFromStream(IStream *pStream,void * pBuff,ULONG ulDataSize);


// Overrides
public:
	virtual BOOL InitInstance();

	DECLARE_MESSAGE_MAP()
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions