GetSystemDirectory() returns the Windows System directory (typically C:\WINDOWS\SYSTEM), which is where most Windows DLLs are stored.  The GetSystemDirectory() function, which exists in KERNEL32.DLL, is not declared in the DLL_KERNEL32 record in SYSPROCS.

To use this function, we can create a new DLL_ record in SYSPROCS (for this example, DLL_TEST), and then run the DECLARE_FCNS routine from the System Monitor to create a record in SYSOBJ that implements the call.  The signature is similar to GetWindowsDirectory().  The DLL_TEST record in SYSPROCS is shown below:

To create the object file $GETSYSTEMDIRECTORY, in SYSOBJ, which calls GetSystemDirectory(), run the DECLARE_FCNS routine from the System Monitor.  The output of a successful run is shown below.

The code, coded from the click event of a button in an OpenInsight window, is shown below:

declare function GetSystemDirectory
sysDirectory = str(' ',255)
retval = GetSystemDirectory( sysDirectory, 255)
call msg(@window, 'System Directory is ' : sysDirectory[1,retval])

When the window is run, and the button is clicked, the output message is shown below:

  • No labels