97 lines
2.1 KiB
C++
97 lines
2.1 KiB
C++
// About.cpp : Implementation of CAbout
|
|
|
|
#include "stdafx.h"
|
|
#include "About.h"
|
|
#include "SLNKDWFVersion.h"
|
|
|
|
#define SECURITY_WIN32
|
|
#include "Security.h"
|
|
|
|
// CAbout
|
|
extern HINSTANCE g_hInstance;
|
|
|
|
// In release mode verwijderen we altijd About.obj om hercompile te forceren
|
|
CString buildDATE(__DATE__);
|
|
CString buildTIME(__TIME__);
|
|
|
|
STDMETHODIMP CAbout::get_All(BSTR* pVal)
|
|
{
|
|
char module[_MAX_PATH]; // HMODULE
|
|
GetModuleFileName(g_hInstance, module, sizeof(module)/sizeof(char));
|
|
char name[_MAX_PATH]; // HMODULE
|
|
ULONG cnt = sizeof(name)/sizeof(char);
|
|
if (!GetUserNameEx(NameSamCompatible, name, &cnt))
|
|
{
|
|
myTRACE("\nGetUserNameEx failed (%d): %s", GetLastError(), myGetLastErrorMsg());
|
|
}
|
|
|
|
CString result;
|
|
result.Format(" SLNKDWF: built on %s, %s"
|
|
"\n DLL: %s"
|
|
"\nUsercontext: %s", buildDATE, buildTIME, module, name);
|
|
(*pVal) = result.AllocSysString();
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CAbout::get_DLLPath(BSTR* pVal)
|
|
{
|
|
char module[_MAX_PATH]; // HMODULE
|
|
GetModuleFileName(g_hInstance, module, sizeof(module));
|
|
|
|
CString result;
|
|
result.Format("%s", module);
|
|
(*pVal) = result.AllocSysString();
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CAbout::get_Buildtime(BSTR* pVal)
|
|
{
|
|
CString result;
|
|
result.Format("%s, %s", buildDATE, buildTIME);
|
|
(*pVal) = result.AllocSysString();
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CAbout::get_UserContext(BSTR* pVal)
|
|
{
|
|
char name[_MAX_PATH]; // HMODULE
|
|
ULONG cnt = sizeof(name)/sizeof(char);
|
|
CString result;
|
|
if (!GetUserNameEx(NameSamCompatible, name, &cnt))
|
|
{
|
|
myTRACE("\nGetUserNameEx failed (%d): %s", GetLastError(), myGetLastErrorMsg());
|
|
result = "Unable to detect user";
|
|
}
|
|
else
|
|
result = name;
|
|
|
|
(*pVal) = result.AllocSysString();
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CAbout::get_VersionMajor(LONG* pVal)
|
|
{
|
|
(*pVal) = SLNK_MAJOR_VERSION;
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CAbout::get_VersionMinor(LONG* pVal)
|
|
{
|
|
(*pVal) = SLNK_MINOR_VERSION;
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
STDMETHODIMP CAbout::get_VersionString(BSTR* pVal)
|
|
{
|
|
CString result = SLNK_BUILDVERSION;
|
|
(*pVal) = result.AllocSysString();
|
|
|
|
return S_OK;
|
|
}
|