Exemple #1
0
bool DisplayHelp()
{
	CPath path;
	if (!::GetModuleFileName(NULL, CStrBufA(path, MAX_PATH), MAX_PATH))
		return false;
	path.StripPath();

	CString str;
	str.FormatMessage(
		_T("Checks the security descriptor on a named object.\n")
		_T("\n")
		_T("Usage: %1 [-?] [-at|-no_at] [-file|-regkey|-service|-kernel|-printer] [objectname]*\n")
		_T("  -?        Display this help message\n")
		_T("  -at       Examine the process access token (default)\n")
		_T("  -no_at    Don't examine the process access token\n")
		_T("  -file     objectname is the name of a file to examine (default)\n")
		_T("  -regkey   objectname is the name of a registry key to examine\n")
		_T("  -service  objectname is the name of a service to examine\n")
		_T("  -kernel   objectname is the name of a kernel object to examine\n")
		_T("            these can be semaphores, events, mutexes, waitable timers, and file mappings\n")
		_T("  -printer  objectname is the name of a printer to examine\n")
		_T("  objectname defaults to \\\\.\\A:\n")
		_T("Example: %1 C:\\boot.ini\n")
		_T("\n")
		_T("Note: \\\\.\\A: is not the same as A:\n")
		_T("Checking \\\\.\\A: checks access to the floppy drive,\n")
		_T("Checking A: checks access to the root directory"),
		path);
	Log(str);

	return false;
}
Exemple #2
0
static CString GetFileName(CString str)
{
	CPath p = str;
	p.StripPath();

	return (LPCTSTR)p;
}
Exemple #3
0
void ShowMessage(int headerId, int bodyId, int footerId, HRESULT hr)
{
	HWND hwndExcel = FindCurrentExcelWindow();
	try
	{
		CString addInFullPath = AddInFullPath();

		CPath addInFileName = addInFullPath;
		addInFileName.StripPath();

		CString msgTitle;
		msgTitle.FormatMessage(IDS_MSG_TITLE, addInFileName);

		CString header;
		header.LoadString(headerId);
		CString body;
		body.LoadString(bodyId);
		CString footer;
		footer.LoadString(footerId);
		CString hresult = "";
		if (hr != S_OK)
		{
			hresult.FormatMessage(IDS_MSG_HRESULT, hr);
		}

		CString msg;
		msg.FormatMessage(IDS_MSG_TEMPLATE, header, body, footer, hresult, addInFullPath);

		MessageBox(hwndExcel, msg, msgTitle, MB_ICONEXCLAMATION);
	}
	catch (...)
	{
		ShowMessageError(hwndExcel);
	}
}
Exemple #4
0
// アーカイブ名からフォルダパスを作成する
void GetArchiveDirectoryPath(const CConfigExtract &ConfExtract,LPCTSTR lpszArcName,CPath &pathDir)
{
	pathDir=lpszArcName;
	pathDir.StripPath();	//パス名からファイル名を取得
	pathDir.RemoveExtension();//アーカイブファイル名から拡張子を削除

	//フォルダ名末尾の数字と記号を取り除く
	if(ConfExtract.RemoveSymbolAndNumber){
		CPath pathOrg=pathDir;
		UtilTrimString(pathDir,g_szTable);
		//数字と記号を取り除いた結果、文字列が空になってしまっていたら元にもどす
		if(_tcslen(pathDir)==0){
			pathDir=pathOrg;
		}
	}

	//空白を取り除く
	UtilTrimString(pathDir,_T(".\\  "));

	if(_tcslen(pathDir)>0){
		pathDir.AddBackslash();
	}
}