Win32 API 日本語リファレンス
ホームNetworking.Clustering › ResUtilGetClusterGroupType

ResUtilGetClusterGroupType

関数
クラスターグループの種別を取得する。
DLLRESUTILS.dll呼出規約winapi

シグネチャ

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

DWORD ResUtilGetClusterGroupType(
    HGROUP hGroup,
    CLUSGROUP_TYPE* groupType
);

パラメーター

名前方向説明
hGroupHGROUPin種別を取得する対象クラスターグループのハンドル。
groupTypeCLUSGROUP_TYPE*inout取得したグループ種別(CLUSGROUP_TYPE)を受け取る変数へのポインター。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ResUtilGetClusterGroupType(
    HGROUP hGroup,
    CLUSGROUP_TYPE* groupType
);
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern uint ResUtilGetClusterGroupType(
    IntPtr hGroup,   // HGROUP
    ref int groupType   // CLUSGROUP_TYPE* in/out
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilGetClusterGroupType(
    hGroup As IntPtr,   ' HGROUP
    ByRef groupType As Integer   ' CLUSGROUP_TYPE* in/out
) As UInteger
End Function
' hGroup : HGROUP
' groupType : CLUSGROUP_TYPE* in/out
Declare PtrSafe Function ResUtilGetClusterGroupType Lib "resutils" ( _
    ByVal hGroup As LongPtr, _
    ByRef groupType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilGetClusterGroupType = ctypes.windll.resutils.ResUtilGetClusterGroupType
ResUtilGetClusterGroupType.restype = wintypes.DWORD
ResUtilGetClusterGroupType.argtypes = [
    ctypes.c_ssize_t,  # hGroup : HGROUP
    ctypes.c_void_p,  # groupType : CLUSGROUP_TYPE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilGetClusterGroupType = Fiddle::Function.new(
  lib['ResUtilGetClusterGroupType'],
  [
    Fiddle::TYPE_INTPTR_T,  # hGroup : HGROUP
    Fiddle::TYPE_VOIDP,  # groupType : CLUSGROUP_TYPE* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "resutils")]
extern "system" {
    fn ResUtilGetClusterGroupType(
        hGroup: isize,  // HGROUP
        groupType: *mut i32  // CLUSGROUP_TYPE* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RESUTILS.dll")]
public static extern uint ResUtilGetClusterGroupType(IntPtr hGroup, ref int groupType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilGetClusterGroupType' -Namespace Win32 -PassThru
# $api::ResUtilGetClusterGroupType(hGroup, groupType)
#uselib "RESUTILS.dll"
#func global ResUtilGetClusterGroupType "ResUtilGetClusterGroupType" sptr, sptr
; ResUtilGetClusterGroupType hGroup, varptr(groupType)   ; 戻り値は stat
; hGroup : HGROUP -> "sptr"
; groupType : CLUSGROUP_TYPE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RESUTILS.dll"
#cfunc global ResUtilGetClusterGroupType "ResUtilGetClusterGroupType" sptr, var
; res = ResUtilGetClusterGroupType(hGroup, groupType)
; hGroup : HGROUP -> "sptr"
; groupType : CLUSGROUP_TYPE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ResUtilGetClusterGroupType(HGROUP hGroup, CLUSGROUP_TYPE* groupType)
#uselib "RESUTILS.dll"
#cfunc global ResUtilGetClusterGroupType "ResUtilGetClusterGroupType" intptr, var
; res = ResUtilGetClusterGroupType(hGroup, groupType)
; hGroup : HGROUP -> "intptr"
; groupType : CLUSGROUP_TYPE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilGetClusterGroupType = resutils.NewProc("ResUtilGetClusterGroupType")
)

// hGroup (HGROUP), groupType (CLUSGROUP_TYPE* in/out)
r1, _, err := procResUtilGetClusterGroupType.Call(
	uintptr(hGroup),
	uintptr(groupType),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ResUtilGetClusterGroupType(
  hGroup: NativeInt;   // HGROUP
  groupType: Pointer   // CLUSGROUP_TYPE* in/out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilGetClusterGroupType';
result := DllCall("RESUTILS\ResUtilGetClusterGroupType"
    , "Ptr", hGroup   ; HGROUP
    , "Ptr", groupType   ; CLUSGROUP_TYPE* in/out
    , "UInt")   ; return: DWORD
●ResUtilGetClusterGroupType(hGroup, groupType) = DLL("RESUTILS.dll", "dword ResUtilGetClusterGroupType(int, void*)")
# 呼び出し: ResUtilGetClusterGroupType(hGroup, groupType)
# hGroup : HGROUP -> "int"
# groupType : CLUSGROUP_TYPE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "resutils" fn ResUtilGetClusterGroupType(
    hGroup: isize, // HGROUP
    groupType: [*c]i32 // CLUSGROUP_TYPE* in/out
) callconv(std.os.windows.WINAPI) u32;
proc ResUtilGetClusterGroupType(
    hGroup: int,  # HGROUP
    groupType: ptr int32  # CLUSGROUP_TYPE* in/out
): uint32 {.importc: "ResUtilGetClusterGroupType", stdcall, dynlib: "RESUTILS.dll".}
pragma(lib, "resutils");
extern(Windows)
uint ResUtilGetClusterGroupType(
    ptrdiff_t hGroup,   // HGROUP
    int* groupType   // CLUSGROUP_TYPE* in/out
);
ccall((:ResUtilGetClusterGroupType, "RESUTILS.dll"), stdcall, UInt32,
      (Int, Ptr{Int32}),
      hGroup, groupType)
# hGroup : HGROUP -> Int
# groupType : CLUSGROUP_TYPE* in/out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ResUtilGetClusterGroupType(
    intptr_t hGroup,
    int32_t* groupType);
]]
local resutils = ffi.load("resutils")
-- resutils.ResUtilGetClusterGroupType(hGroup, groupType)
-- hGroup : HGROUP
-- groupType : CLUSGROUP_TYPE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RESUTILS.dll');
const ResUtilGetClusterGroupType = lib.func('__stdcall', 'ResUtilGetClusterGroupType', 'uint32_t', ['intptr_t', 'int32_t *']);
// ResUtilGetClusterGroupType(hGroup, groupType)
// hGroup : HGROUP -> 'intptr_t'
// groupType : CLUSGROUP_TYPE* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RESUTILS.dll", {
  ResUtilGetClusterGroupType: { parameters: ["isize", "pointer"], result: "u32" },
});
// lib.symbols.ResUtilGetClusterGroupType(hGroup, groupType)
// hGroup : HGROUP -> "isize"
// groupType : CLUSGROUP_TYPE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ResUtilGetClusterGroupType(
    intptr_t hGroup,
    int32_t* groupType);
C, "RESUTILS.dll");
// $ffi->ResUtilGetClusterGroupType(hGroup, groupType);
// hGroup : HGROUP
// groupType : CLUSGROUP_TYPE* in/out
// 構造体/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 Resutils extends StdCallLibrary {
    Resutils INSTANCE = Native.load("resutils", Resutils.class);
    int ResUtilGetClusterGroupType(
        long hGroup,   // HGROUP
        IntByReference groupType   // CLUSGROUP_TYPE* in/out
    );
}
@[Link("resutils")]
lib LibRESUTILS
  fun ResUtilGetClusterGroupType = ResUtilGetClusterGroupType(
    hGroup : LibC::SSizeT,   # HGROUP
    groupType : Int32*   # CLUSGROUP_TYPE* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ResUtilGetClusterGroupTypeNative = Uint32 Function(IntPtr, Pointer<Int32>);
typedef ResUtilGetClusterGroupTypeDart = int Function(int, Pointer<Int32>);
final ResUtilGetClusterGroupType = DynamicLibrary.open('RESUTILS.dll')
    .lookupFunction<ResUtilGetClusterGroupTypeNative, ResUtilGetClusterGroupTypeDart>('ResUtilGetClusterGroupType');
// hGroup : HGROUP -> IntPtr
// groupType : CLUSGROUP_TYPE* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ResUtilGetClusterGroupType(
  hGroup: NativeInt;   // HGROUP
  groupType: Pointer   // CLUSGROUP_TYPE* in/out
): DWORD; stdcall;
  external 'RESUTILS.dll' name 'ResUtilGetClusterGroupType';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ResUtilGetClusterGroupType"
  c_ResUtilGetClusterGroupType :: CIntPtr -> Ptr Int32 -> IO Word32
-- hGroup : HGROUP -> CIntPtr
-- groupType : CLUSGROUP_TYPE* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let resutilgetclustergrouptype =
  foreign "ResUtilGetClusterGroupType"
    (intptr_t @-> (ptr int32_t) @-> returning uint32_t)
(* hGroup : HGROUP -> intptr_t *)
(* groupType : CLUSGROUP_TYPE* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library resutils (t "RESUTILS.dll"))
(cffi:use-foreign-library resutils)

(cffi:defcfun ("ResUtilGetClusterGroupType" res-util-get-cluster-group-type :convention :stdcall) :uint32
  (h-group :int64)   ; HGROUP
  (group-type :pointer))   ; CLUSGROUP_TYPE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ResUtilGetClusterGroupType = Win32::API::More->new('RESUTILS',
    'DWORD ResUtilGetClusterGroupType(LPARAM hGroup, LPVOID groupType)');
# my $ret = $ResUtilGetClusterGroupType->Call($hGroup, $groupType);
# hGroup : HGROUP -> LPARAM
# groupType : CLUSGROUP_TYPE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型