Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- set PATH=c:\Windows\Microsoft.NET\Framework64\v4.0.30319;%PATH%
- cls && csc.exe -debug- -target:winexe -platform:x64 -r:sntl_adminapi_net_windows.dll sntl_adminapi_net_windows.cs && sntl_adminapi_net_windows.exe
- */
- using System;
- //using System.Collections.Generic;
- //using System.Text;
- //using System.Text.RegularExpressions;
- using System.Runtime.InteropServices; // ez a névtér szükséges a DLL-ek miatt
- using System.Xml;
- using System.IO;
- using SafeNet.Sentinel;
- public class WinAPI
- {
- [DllImport("user32.dll")]
- public static extern int MessageBox(int hWnd, string text, string caption, uint type);
- }
- namespace TrySentinelLDK
- {
- class TrySentinelLDK
- {
- private static AdminApi adminApi;
- private static int vendorId = 00000;
- static void Main(string[] args)
- {
- string scope = "";
- string format = "";
- string info = "";
- adminApi = new AdminApi("localhost", 1947, "");
- AdminStatus rc = default(AdminStatus);
- try
- {
- rc = adminApi.connect();
- //WinAPI.MessageBox(0, "["+rc.ToString()+"]", "MessageBox...", 0);
- scope = "<haspscope>" +
- " <vendor id=\"" + vendorId + "\" />" +
- "</haspscope>";
- format = "<admin> <hasp>" +
- //" <element name=\"*\" />" +
- " <element name=\"haspid\" />" +
- "</hasp></admin>";
- rc = adminApi.adminGet( scope, format, ref info );
- //Console.WriteLine(info);
- //WinAPI.MessageBox(0, "["+rc.ToString()+"]" + Convert.ToChar(10)+ Convert.ToChar(10) + info, "MessageBox...", 0);
- XmlReader reader = XmlReader.Create(new StringReader(info));
- while (reader.Read())
- {
- if (reader.NodeType==XmlNodeType.Element && reader.Name == "haspid")
- {
- if (reader.Read())
- //Console.WriteLine("___"+reader.Value+"___");
- WinAPI.MessageBox(0, reader.Value, "Kulcs sorszám...", 0);
- break;
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.Message);
- }
- //Console.WriteLine("Press any key to exit.");
- //Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement