PathIsSystemFolderA
関数指定したフォルダがシステムフォルダかどうかを判定する。
シグネチャ
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
BOOL PathIsSystemFolderA(
LPCSTR pszPath, // optional
DWORD dwAttrb
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPath | LPCSTR | inoptional |
| dwAttrb | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// SHLWAPI.dll (ANSI / -A)
#include <windows.h>
BOOL PathIsSystemFolderA(
LPCSTR pszPath, // optional
DWORD dwAttrb
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool PathIsSystemFolderA(
[MarshalAs(UnmanagedType.LPStr)] string pszPath, // LPCSTR optional
uint dwAttrb // DWORD
);<DllImport("SHLWAPI.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function PathIsSystemFolderA(
<MarshalAs(UnmanagedType.LPStr)> pszPath As String, ' LPCSTR optional
dwAttrb As UInteger ' DWORD
) As Boolean
End Function' pszPath : LPCSTR optional
' dwAttrb : DWORD
Declare PtrSafe Function PathIsSystemFolderA Lib "shlwapi" ( _
ByVal pszPath As String, _
ByVal dwAttrb As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PathIsSystemFolderA = ctypes.windll.shlwapi.PathIsSystemFolderA
PathIsSystemFolderA.restype = wintypes.BOOL
PathIsSystemFolderA.argtypes = [
wintypes.LPCSTR, # pszPath : LPCSTR optional
wintypes.DWORD, # dwAttrb : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SHLWAPI.dll')
PathIsSystemFolderA = Fiddle::Function.new(
lib['PathIsSystemFolderA'],
[
Fiddle::TYPE_VOIDP, # pszPath : LPCSTR optional
-Fiddle::TYPE_INT, # dwAttrb : DWORD
],
Fiddle::TYPE_INT)#[link(name = "shlwapi")]
extern "system" {
fn PathIsSystemFolderA(
pszPath: *const u8, // LPCSTR optional
dwAttrb: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SHLWAPI.dll", CharSet = CharSet.Ansi)]
public static extern bool PathIsSystemFolderA([MarshalAs(UnmanagedType.LPStr)] string pszPath, uint dwAttrb);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SHLWAPI_PathIsSystemFolderA' -Namespace Win32 -PassThru
# $api::PathIsSystemFolderA(pszPath, dwAttrb)#uselib "SHLWAPI.dll"
#func global PathIsSystemFolderA "PathIsSystemFolderA" sptr, sptr
; PathIsSystemFolderA pszPath, dwAttrb ; 戻り値は stat
; pszPath : LPCSTR optional -> "sptr"
; dwAttrb : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SHLWAPI.dll"
#cfunc global PathIsSystemFolderA "PathIsSystemFolderA" str, int
; res = PathIsSystemFolderA(pszPath, dwAttrb)
; pszPath : LPCSTR optional -> "str"
; dwAttrb : DWORD -> "int"; BOOL PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb)
#uselib "SHLWAPI.dll"
#cfunc global PathIsSystemFolderA "PathIsSystemFolderA" str, int
; res = PathIsSystemFolderA(pszPath, dwAttrb)
; pszPath : LPCSTR optional -> "str"
; dwAttrb : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
shlwapi = windows.NewLazySystemDLL("SHLWAPI.dll")
procPathIsSystemFolderA = shlwapi.NewProc("PathIsSystemFolderA")
)
// pszPath (LPCSTR optional), dwAttrb (DWORD)
r1, _, err := procPathIsSystemFolderA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszPath))),
uintptr(dwAttrb),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction PathIsSystemFolderA(
pszPath: PAnsiChar; // LPCSTR optional
dwAttrb: DWORD // DWORD
): BOOL; stdcall;
external 'SHLWAPI.dll' name 'PathIsSystemFolderA';result := DllCall("SHLWAPI\PathIsSystemFolderA"
, "AStr", pszPath ; LPCSTR optional
, "UInt", dwAttrb ; DWORD
, "Int") ; return: BOOL●PathIsSystemFolderA(pszPath, dwAttrb) = DLL("SHLWAPI.dll", "bool PathIsSystemFolderA(char*, dword)")
# 呼び出し: PathIsSystemFolderA(pszPath, dwAttrb)
# pszPath : LPCSTR optional -> "char*"
# dwAttrb : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。