Win32 API 日本語リファレンス
ホームUI.Shell.PropertiesSystem › PSUnregisterPropertySchema

PSUnregisterPropertySchema

関数
プロパティスキーマ定義の登録を解除する。
DLLPROPSYS.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// PROPSYS.dll
#include <windows.h>

HRESULT PSUnregisterPropertySchema(
    LPCWSTR pszPath
);

パラメーター

名前方向説明
pszPathLPCWSTRin登録解除するプロパティスキーマ定義(.propdesc)ファイルのパス。

戻り値の型: HRESULT

各言語での呼び出し定義

// PROPSYS.dll
#include <windows.h>

HRESULT PSUnregisterPropertySchema(
    LPCWSTR pszPath
);
[DllImport("PROPSYS.dll", ExactSpelling = true)]
static extern int PSUnregisterPropertySchema(
    [MarshalAs(UnmanagedType.LPWStr)] string pszPath   // LPCWSTR
);
<DllImport("PROPSYS.dll", ExactSpelling:=True)>
Public Shared Function PSUnregisterPropertySchema(
    <MarshalAs(UnmanagedType.LPWStr)> pszPath As String   ' LPCWSTR
) As Integer
End Function
' pszPath : LPCWSTR
Declare PtrSafe Function PSUnregisterPropertySchema Lib "propsys" ( _
    ByVal pszPath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PSUnregisterPropertySchema = ctypes.windll.propsys.PSUnregisterPropertySchema
PSUnregisterPropertySchema.restype = ctypes.c_int
PSUnregisterPropertySchema.argtypes = [
    wintypes.LPCWSTR,  # pszPath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('PROPSYS.dll')
PSUnregisterPropertySchema = Fiddle::Function.new(
  lib['PSUnregisterPropertySchema'],
  [
    Fiddle::TYPE_VOIDP,  # pszPath : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "propsys")]
extern "system" {
    fn PSUnregisterPropertySchema(
        pszPath: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("PROPSYS.dll")]
public static extern int PSUnregisterPropertySchema([MarshalAs(UnmanagedType.LPWStr)] string pszPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'PROPSYS_PSUnregisterPropertySchema' -Namespace Win32 -PassThru
# $api::PSUnregisterPropertySchema(pszPath)
#uselib "PROPSYS.dll"
#func global PSUnregisterPropertySchema "PSUnregisterPropertySchema" sptr
; PSUnregisterPropertySchema pszPath   ; 戻り値は stat
; pszPath : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "PROPSYS.dll"
#cfunc global PSUnregisterPropertySchema "PSUnregisterPropertySchema" wstr
; res = PSUnregisterPropertySchema(pszPath)
; pszPath : LPCWSTR -> "wstr"
; HRESULT PSUnregisterPropertySchema(LPCWSTR pszPath)
#uselib "PROPSYS.dll"
#cfunc global PSUnregisterPropertySchema "PSUnregisterPropertySchema" wstr
; res = PSUnregisterPropertySchema(pszPath)
; pszPath : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	propsys = windows.NewLazySystemDLL("PROPSYS.dll")
	procPSUnregisterPropertySchema = propsys.NewProc("PSUnregisterPropertySchema")
)

// pszPath (LPCWSTR)
r1, _, err := procPSUnregisterPropertySchema.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPath))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PSUnregisterPropertySchema(
  pszPath: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'PROPSYS.dll' name 'PSUnregisterPropertySchema';
result := DllCall("PROPSYS\PSUnregisterPropertySchema"
    , "WStr", pszPath   ; LPCWSTR
    , "Int")   ; return: HRESULT
●PSUnregisterPropertySchema(pszPath) = DLL("PROPSYS.dll", "int PSUnregisterPropertySchema(char*)")
# 呼び出し: PSUnregisterPropertySchema(pszPath)
# pszPath : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "propsys" fn PSUnregisterPropertySchema(
    pszPath: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
proc PSUnregisterPropertySchema(
    pszPath: WideCString  # LPCWSTR
): int32 {.importc: "PSUnregisterPropertySchema", stdcall, dynlib: "PROPSYS.dll".}
pragma(lib, "propsys");
extern(Windows)
int PSUnregisterPropertySchema(
    const(wchar)* pszPath   // LPCWSTR
);
ccall((:PSUnregisterPropertySchema, "PROPSYS.dll"), stdcall, Int32,
      (Cwstring,),
      pszPath)
# pszPath : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t PSUnregisterPropertySchema(
    const uint16_t* pszPath);
]]
local propsys = ffi.load("propsys")
-- propsys.PSUnregisterPropertySchema(pszPath)
-- pszPath : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('PROPSYS.dll');
const PSUnregisterPropertySchema = lib.func('__stdcall', 'PSUnregisterPropertySchema', 'int32_t', ['str16']);
// PSUnregisterPropertySchema(pszPath)
// pszPath : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("PROPSYS.dll", {
  PSUnregisterPropertySchema: { parameters: ["buffer"], result: "i32" },
});
// lib.symbols.PSUnregisterPropertySchema(pszPath)
// pszPath : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t PSUnregisterPropertySchema(
    const uint16_t* pszPath);
C, "PROPSYS.dll");
// $ffi->PSUnregisterPropertySchema(pszPath);
// pszPath : LPCWSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Propsys extends StdCallLibrary {
    Propsys INSTANCE = Native.load("propsys", Propsys.class);
    int PSUnregisterPropertySchema(
        WString pszPath   // LPCWSTR
    );
}
@[Link("propsys")]
lib LibPROPSYS
  fun PSUnregisterPropertySchema = PSUnregisterPropertySchema(
    pszPath : UInt16*   # LPCWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef PSUnregisterPropertySchemaNative = Int32 Function(Pointer<Utf16>);
typedef PSUnregisterPropertySchemaDart = int Function(Pointer<Utf16>);
final PSUnregisterPropertySchema = DynamicLibrary.open('PROPSYS.dll')
    .lookupFunction<PSUnregisterPropertySchemaNative, PSUnregisterPropertySchemaDart>('PSUnregisterPropertySchema');
// pszPath : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PSUnregisterPropertySchema(
  pszPath: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'PROPSYS.dll' name 'PSUnregisterPropertySchema';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PSUnregisterPropertySchema"
  c_PSUnregisterPropertySchema :: CWString -> IO Int32
-- pszPath : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let psunregisterpropertyschema =
  foreign "PSUnregisterPropertySchema"
    ((ptr uint16_t) @-> returning int32_t)
(* pszPath : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library propsys (t "PROPSYS.dll"))
(cffi:use-foreign-library propsys)

(cffi:defcfun ("PSUnregisterPropertySchema" psunregister-property-schema :convention :stdcall) :int32
  (psz-path (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PSUnregisterPropertySchema = Win32::API::More->new('PROPSYS',
    'int PSUnregisterPropertySchema(LPCWSTR pszPath)');
# my $ret = $PSUnregisterPropertySchema->Call($pszPath);
# pszPath : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。