Retrieves the name of the current process's module.
Public Declare Function PKI_ModuleName Lib "diCrPKI.dll"
(ByVal strName As String, ByVal nStrLen As Long, ByVal nOptions As Long) As Long
nRet = PKI_ModuleName(strName, nStrLen, 0)
long __stdcall PKI_ModuleName(char *szOutput, long nOutChars, long nOptions);
If successful, the return value is the number of characters in or required for the output string; otherwise it returns a negative error code.
Public Function pkiModuleName
(Optional nOptions As Long = 0) As String
static std::string dipki::Gen::ModuleName ()
static Gen.module_name()
For the "raw" VBA/C function, the user must allocate an output string buffer szOutput of the required length. Specify a zero nOutChars or an empty string for szOutput to find the required length. ANSI C users must add one to this value when allocating memory.
If using the Win32 DLL in the system folder on a 64-bit system,
Windows will return "C:\WINDOWS\SYSTEM32\diCrPKI.dll"
when the DLL file path is actually
"C:\WINDOWS\SYSWOW64\diCrPKI.dll"
.
Use PKI_Platform
to find out exactly which DLL is being used.
Dim nLen As Long Dim strModuleName As String nLen = PKI_ModuleName("", 0, 0) If nLen > 0 Then strModuleName = String(nLen, " ") nLen = PKI_ModuleName(strModuleName, nLen, 0) strModuleName = Left(strModuleName, nLen) Debug.Print "PKI_ModuleName returns " & nLen & " [" & strModuleName & "]" Else Debug.Print "Error " & nLen & " with PKI_ModuleName" End If
On our W10 system, this produces the output:
PKI_ModuleName returns 31 [C:\WINDOWS\SYSTEM32\diCrPKI.dll]
Debug.Print pkiCompileTime()
Debug.Print pkiModuleInfo()
Debug.Print pkiModuleName()
Debug.Print pkiPlatform()