ホーム › System.GroupPolicy › ImportRSoPData
ImportRSoPData
関数RSoPデータをWMI名前空間にインポートする。
シグネチャ
// GPEDIT.dll
#include <windows.h>
HRESULT ImportRSoPData(
LPWSTR lpNameSpace,
LPWSTR lpFileName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpNameSpace | LPWSTR | in |
| lpFileName | LPWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// GPEDIT.dll
#include <windows.h>
HRESULT ImportRSoPData(
LPWSTR lpNameSpace,
LPWSTR lpFileName
);[DllImport("GPEDIT.dll", ExactSpelling = true)]
static extern int ImportRSoPData(
[MarshalAs(UnmanagedType.LPWStr)] string lpNameSpace, // LPWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpFileName // LPWSTR
);<DllImport("GPEDIT.dll", ExactSpelling:=True)>
Public Shared Function ImportRSoPData(
<MarshalAs(UnmanagedType.LPWStr)> lpNameSpace As String, ' LPWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpFileName As String ' LPWSTR
) As Integer
End Function' lpNameSpace : LPWSTR
' lpFileName : LPWSTR
Declare PtrSafe Function ImportRSoPData Lib "gpedit" ( _
ByVal lpNameSpace As LongPtr, _
ByVal lpFileName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ImportRSoPData = ctypes.windll.gpedit.ImportRSoPData
ImportRSoPData.restype = ctypes.c_int
ImportRSoPData.argtypes = [
wintypes.LPCWSTR, # lpNameSpace : LPWSTR
wintypes.LPCWSTR, # lpFileName : LPWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GPEDIT.dll')
ImportRSoPData = Fiddle::Function.new(
lib['ImportRSoPData'],
[
Fiddle::TYPE_VOIDP, # lpNameSpace : LPWSTR
Fiddle::TYPE_VOIDP, # lpFileName : LPWSTR
],
Fiddle::TYPE_INT)#[link(name = "gpedit")]
extern "system" {
fn ImportRSoPData(
lpNameSpace: *mut u16, // LPWSTR
lpFileName: *mut u16 // LPWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GPEDIT.dll")]
public static extern int ImportRSoPData([MarshalAs(UnmanagedType.LPWStr)] string lpNameSpace, [MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GPEDIT_ImportRSoPData' -Namespace Win32 -PassThru
# $api::ImportRSoPData(lpNameSpace, lpFileName)#uselib "GPEDIT.dll"
#func global ImportRSoPData "ImportRSoPData" sptr, sptr
; ImportRSoPData lpNameSpace, lpFileName ; 戻り値は stat
; lpNameSpace : LPWSTR -> "sptr"
; lpFileName : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GPEDIT.dll"
#cfunc global ImportRSoPData "ImportRSoPData" wstr, wstr
; res = ImportRSoPData(lpNameSpace, lpFileName)
; lpNameSpace : LPWSTR -> "wstr"
; lpFileName : LPWSTR -> "wstr"; HRESULT ImportRSoPData(LPWSTR lpNameSpace, LPWSTR lpFileName)
#uselib "GPEDIT.dll"
#cfunc global ImportRSoPData "ImportRSoPData" wstr, wstr
; res = ImportRSoPData(lpNameSpace, lpFileName)
; lpNameSpace : LPWSTR -> "wstr"
; lpFileName : LPWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gpedit = windows.NewLazySystemDLL("GPEDIT.dll")
procImportRSoPData = gpedit.NewProc("ImportRSoPData")
)
// lpNameSpace (LPWSTR), lpFileName (LPWSTR)
r1, _, err := procImportRSoPData.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpNameSpace))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpFileName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ImportRSoPData(
lpNameSpace: PWideChar; // LPWSTR
lpFileName: PWideChar // LPWSTR
): Integer; stdcall;
external 'GPEDIT.dll' name 'ImportRSoPData';result := DllCall("GPEDIT\ImportRSoPData"
, "WStr", lpNameSpace ; LPWSTR
, "WStr", lpFileName ; LPWSTR
, "Int") ; return: HRESULT●ImportRSoPData(lpNameSpace, lpFileName) = DLL("GPEDIT.dll", "int ImportRSoPData(char*, char*)")
# 呼び出し: ImportRSoPData(lpNameSpace, lpFileName)
# lpNameSpace : LPWSTR -> "char*"
# lpFileName : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。