Win32 API 日本語リファレンス
ホームSystem.WinRT › RoGetServerActivatableClasses

RoGetServerActivatableClasses

関数
指定サーバーがアクティブ化可能なクラスID一覧を取得する。
DLLapi-ms-win-core-winrt-registration-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-core-winrt-registration-l1-1-0.dll
#include <windows.h>

HRESULT RoGetServerActivatableClasses(
    HSTRING serverName,
    HSTRING** activatableClassIds,
    DWORD* count
);

パラメーター

名前方向説明
serverNameHSTRINGinアクティブ化可能クラスを問い合わせるサーバー名を保持するHSTRING。
activatableClassIdsHSTRING**out出力としてクラス名(HSTRING)配列を受け取るポインタのアドレス。
countDWORD*out出力として返されたクラス数を受け取るDWORDポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-core-winrt-registration-l1-1-0.dll
#include <windows.h>

HRESULT RoGetServerActivatableClasses(
    HSTRING serverName,
    HSTRING** activatableClassIds,
    DWORD* count
);
[DllImport("api-ms-win-core-winrt-registration-l1-1-0.dll", ExactSpelling = true)]
static extern int RoGetServerActivatableClasses(
    IntPtr serverName,   // HSTRING
    IntPtr activatableClassIds,   // HSTRING** out
    out uint count   // DWORD* out
);
<DllImport("api-ms-win-core-winrt-registration-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function RoGetServerActivatableClasses(
    serverName As IntPtr,   ' HSTRING
    activatableClassIds As IntPtr,   ' HSTRING** out
    <Out> ByRef count As UInteger   ' DWORD* out
) As Integer
End Function
' serverName : HSTRING
' activatableClassIds : HSTRING** out
' count : DWORD* out
Declare PtrSafe Function RoGetServerActivatableClasses Lib "api-ms-win-core-winrt-registration-l1-1-0" ( _
    ByVal serverName As LongPtr, _
    ByVal activatableClassIds As LongPtr, _
    ByRef count As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RoGetServerActivatableClasses = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-registration-l1-1-0.dll").RoGetServerActivatableClasses
RoGetServerActivatableClasses.restype = ctypes.c_int
RoGetServerActivatableClasses.argtypes = [
    wintypes.HANDLE,  # serverName : HSTRING
    ctypes.c_void_p,  # activatableClassIds : HSTRING** out
    ctypes.POINTER(wintypes.DWORD),  # count : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	api_ms_win_core_winrt_registration_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-winrt-registration-l1-1-0.dll")
	procRoGetServerActivatableClasses = api_ms_win_core_winrt_registration_l1_1_0.NewProc("RoGetServerActivatableClasses")
)

// serverName (HSTRING), activatableClassIds (HSTRING** out), count (DWORD* out)
r1, _, err := procRoGetServerActivatableClasses.Call(
	uintptr(serverName),
	uintptr(activatableClassIds),
	uintptr(count),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RoGetServerActivatableClasses(
  serverName: THandle;   // HSTRING
  activatableClassIds: Pointer;   // HSTRING** out
  count: Pointer   // DWORD* out
): Integer; stdcall;
  external 'api-ms-win-core-winrt-registration-l1-1-0.dll' name 'RoGetServerActivatableClasses';
result := DllCall("api-ms-win-core-winrt-registration-l1-1-0\RoGetServerActivatableClasses"
    , "Ptr", serverName   ; HSTRING
    , "Ptr", activatableClassIds   ; HSTRING** out
    , "Ptr", count   ; DWORD* out
    , "Int")   ; return: HRESULT
●RoGetServerActivatableClasses(serverName, activatableClassIds, count) = DLL("api-ms-win-core-winrt-registration-l1-1-0.dll", "int RoGetServerActivatableClasses(void*, void*, void*)")
# 呼び出し: RoGetServerActivatableClasses(serverName, activatableClassIds, count)
# serverName : HSTRING -> "void*"
# activatableClassIds : HSTRING** out -> "void*"
# count : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef RoGetServerActivatableClassesNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef RoGetServerActivatableClassesDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final RoGetServerActivatableClasses = DynamicLibrary.open('api-ms-win-core-winrt-registration-l1-1-0.dll')
    .lookupFunction<RoGetServerActivatableClassesNative, RoGetServerActivatableClassesDart>('RoGetServerActivatableClasses');
// serverName : HSTRING -> Pointer<Void>
// activatableClassIds : HSTRING** out -> Pointer<Void>
// count : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RoGetServerActivatableClasses(
  serverName: THandle;   // HSTRING
  activatableClassIds: Pointer;   // HSTRING** out
  count: Pointer   // DWORD* out
): Integer; stdcall;
  external 'api-ms-win-core-winrt-registration-l1-1-0.dll' name 'RoGetServerActivatableClasses';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RoGetServerActivatableClasses"
  c_RoGetServerActivatableClasses :: Ptr () -> Ptr () -> Ptr Word32 -> IO Int32
-- serverName : HSTRING -> Ptr ()
-- activatableClassIds : HSTRING** out -> Ptr ()
-- count : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rogetserveractivatableclasses =
  foreign "RoGetServerActivatableClasses"
    ((ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* serverName : HSTRING -> (ptr void) *)
(* activatableClassIds : HSTRING** out -> (ptr void) *)
(* count : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library api-ms-win-core-winrt-registration-l1-1-0 (t "api-ms-win-core-winrt-registration-l1-1-0.dll"))
(cffi:use-foreign-library api-ms-win-core-winrt-registration-l1-1-0)

(cffi:defcfun ("RoGetServerActivatableClasses" ro-get-server-activatable-classes :convention :stdcall) :int32
  (server-name :pointer)   ; HSTRING
  (activatable-class-ids :pointer)   ; HSTRING** out
  (count :pointer))   ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RoGetServerActivatableClasses = Win32::API::More->new('api-ms-win-core-winrt-registration-l1-1-0',
    'int RoGetServerActivatableClasses(HANDLE serverName, HANDLE activatableClassIds, LPVOID count)');
# my $ret = $RoGetServerActivatableClasses->Call($serverName, $activatableClassIds, $count);
# serverName : HSTRING -> HANDLE
# activatableClassIds : HSTRING** out -> HANDLE
# count : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。