Windows Shell declarations for folder-path lookup through caller-supplied UTF-16 storage.


Constants

Folder identifiers and path selection

NameValueMeaning
CSIDL_APPDATA0x001APer-user application-data folder identifier.
SHGFP_TYPE_CURRENT0Selects the current folder path.
SHGFP_TYPE_DEFAULT1Selects the default folder path.

Constant example

"control"         use
"windows/shell32" use

{} () {} [
  CSIDL_APPDATA printStack _:;
  SHGFP_TYPE_CURRENT printStack _:;
  SHGFP_TYPE_DEFAULT printStack _:;
] "main" exportFunction

Expected Output During Compilation

26
0
1

Imported functions

Stack effects list a C function's parameters with the first parameter on top; see importFunction.

SHGetFolderPathW

(pszPath dwFlags hToken csidl hwnd -- result) Retrieves a Shell folder path.

Inputs

  • pszPath: Natx address of caller-owned writable storage for at least 260 UTF-16 code units; on success the call writes a zero-terminated folder path.
  • dwFlags: Nat32 path-selection value; cast the Int32 constants before passing them, for example SHGFP_TYPE_CURRENT 0n32 cast.
  • hToken: Natx access-token handle, or 0nx for the current user.
  • csidl: Int32 CSIDL folder identifier such as CSIDL_APPDATA.
  • hwnd: HWND reserved; pass a NIL HWND.

Outputs

  • result: Int32 0 on success, or a nonzero status otherwise.

Signature example

Printing @SHGetFolderPathW during compilation shows its imported Code signature.

"control"         use
"windows/shell32" use

{} Int32 {} [
  @SHGetFolderPathW printStack _:;
  0
] "main" exportFunction

Expected Output During Compilation

{hwnd: {WND: (); unused: Int32;} Cref; csidl: Int32; hToken: Natx; dwFlags: Nat32; pszPath: Natx;} Int32 {convention: "";} codeRef

See also