{"id":4976,"date":"2014-08-19T15:49:53","date_gmt":"2014-08-19T06:49:53","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=4976"},"modified":"2014-08-19T16:06:07","modified_gmt":"2014-08-19T07:06:07","slug":"%e3%83%9b%e3%82%b9%e3%83%88%e5%90%8d%e3%81%8b%e3%82%89-netbios-%e3%82%b3%e3%83%b3%e3%83%94%e3%83%a5%e3%83%bc%e3%82%bf%e5%90%8d%e3%82%92%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%e7%9a%84%e3%81%ab","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=4976","title":{"rendered":"DNS \u30db\u30b9\u30c8\u540d\u304b\u3089 NetBIOS \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u7684\u306b\u53d6\u5f97\u3059\u308b (Windows\/C++\/Win32API)"},"content":{"rendered":"<p>DNS \u30db\u30b9\u30c8\u540d\u304b\u3089 NetBIOS \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u307e\u305a\u3001\u305d\u306e\u3082\u306e\u30ba\u30d0\u30ea\u306e\u540d\u524d\u3092\u6301\u3064 API \u3067\u3042\u308b <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ms724244%28v=vs.85%29.aspx\">DnsHostnameToComputerName()<\/a> \u3068\u3044\u3046\u306e\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u304a\u30fc\u3067\u304d\u3066\u308b\u3067\u304d\u3066\u308b\u2026\u3068\u601d\u3063\u3066 &#8220;localhos&#8221; \uff08localhost \u3067\u306f\u306a\u3044\uff09\u3068\u304b\u6e21\u3059\u3068 &#8220;LOCALHOS&#8221; \u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002\u3088\u304f\u8aac\u660e\u3092\u8aad\u3080\u3068 &#8220;This function performs a textual mapping of the name.&#8221; \u306a\u3069\u3068\u66f8\u3044\u3066\u3042\u3063\u3066\u3001\u4f55\u306e\u5f79\u306b\u3082\u7acb\u305f\u306a\u3044\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u3044\u308d\u3044\u308d\u8ff7\u8d70\u3057\u3064\u3064\u3001\u6570\u6642\u9593\u304b\u3051\u3066 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa370663%28v=vs.85%29.aspx\">NetWkstaGetInfo()<\/a> \u306b\u305f\u3069\u308a\u7740\u304d\u307e\u3057\u305f\u3002wksta \u306f workstation \u306e\u7565\u3067\u3059\u304c\u3001\u5909\u306a\u7701\u7565\u306f\u3084\u3081\u3066\u307b\u3057\u3044\u3082\u306e\u3067\u3059\u3002\u6700\u521d wktk \u304b\u3068\u601d\u3044\u307e\u3057\u305f\u3002<\/p>\n<blockquote>\n<pre>#include &lt;stdio.h&gt;\r\n\r\n#include &lt;windows.h&gt;\r\n#include &lt;lm.h&gt;\r\n\r\n#pragma comment(lib, \"netapi32.lib\")\r\n\r\nint wmain(int argc, wchar_t **argv)\r\n{\r\n\tWKSTA_INFO_100 *wki = NULL;\r\n\tNET_API_STATUS st;\r\n\r\n\tif ((st = NetWkstaGetInfo(argv[1], 100, (LPBYTE *)&wki)) != NERR_Success)\r\n\t{\r\n\t\twprintf(L\"error %d\\n\", st);\r\n\t\treturn 1;\r\n\t}\r\n\r\n\twprintf(L\"%s\\n\", wki->wki100_computername);\r\n\treturn 0;\r\n}<\/pre>\n<\/blockquote>\n<blockquote>\n<pre>C:\\Users\\umezawa\\Documents>NetWkstaGetInfo nyx.local\r\nNYX\r\nC:\\Users\\umezawa\\Documents>NetWkstaGetInfo nyx\r\nNYX\r\nC:\\Users\\umezawa\\Documents>NetWkstaGetInfo somealias.local\r\nNYX\r\nC:\\Users\\umezawa\\Documents>NetWkstaGetInfo nonexistent.local\r\nerror 53<\/pre>\n<\/blockquote>\n<p>\u3061\u306a\u307f\u306b\u4f3c\u305f\u540d\u524d\u3067 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa370624%28v=vs.85%29.aspx\">NetServerGetInfo()<\/a> \u3068\u3044\u3046\u306e\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3063\u3061\u306f\u5f15\u6570\u306b\u6e21\u3057\u305f\u30b5\u30fc\u30d0\u540d\u304c\u305d\u306e\u307e\u307e\u8fd4\u3063\u3066\u304f\u308b\u3088\u3046\u3067\u3059\u3002\u306a\u3093\u3067\u3084\u306d\u3093\u3002<\/p>\n<p>\u306a\u304a\u3001\u9006\u3001\u3064\u307e\u308a\u300cDNS \u30db\u30b9\u30c8\u540d\u304b NetBIOS \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d\u304b\u5206\u304b\u3089\u306a\u3044\u3082\u306e\u304c\u4e0e\u3048\u3089\u308c\u305f\u3068\u304d\u306b\u3001\u305d\u306e DNS \u30db\u30b9\u30c8\u540d\u3092\u53d6\u5f97\u3059\u308b\u300d\u306f\u3001gethostbyname() \u3057\u3066\u304b\u3089 getnameinfo() \u3059\u308c\u3070\u3088\u3044\u306f\u305a\u3067\u3059\uff08\u8a66\u3057\u3066\u306a\u3044\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>DNS \u30db\u30b9\u30c8\u540d\u304b\u3089 NetBIOS \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u540d\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-4976","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4976"}],"version-history":[{"count":9,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4976\/revisions"}],"predecessor-version":[{"id":4985,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/4976\/revisions\/4985"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4976"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}