博文

目前显示的是 2020的博文

如何编程获得weblogic的servername、ListenAddress 、port、version

参考 get-the-name-of-the-server-in-which-i-am-receiving-requests-to-my-app-on-weblogi try { InitialContext ctx = new InitialContext(); String serverName = System.getProperty("weblogic.Name"); MBeanServer server = (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime"); ObjectName objName = new ObjectName("com.bea:Name=" + serverName + ",Type=ServerRuntime"); Integer port = (Integer)server.getAttribute(objName, "ListenPort"); String ListenAddress = (String)server.getAttribute(objName, "ListenAddress"); String WeblogicVersion = (String)server.getAttribute(objName, "WeblogicVersion"); System.out.println("Server Name : " + serverName + "Listen Address : " + ListenAddress + " PORT : " + port + " WeblogicVersion : " + WeblogicVersion); } catch(Exception e) { // }

枚举进程所有文件句柄

    代码来自 Enumerating opened handles from a process ,改了几个小bug      #ifndef UNICODE #define UNICODE #endif #include "stdafx.h" #include <windows.h> #include <stdio.h> #define NT_SUCCESS(x) ((x) >= 0) #define STATUS_INFO_LENGTH_MISMATCH 0xc0000004 #define SystemHandleInformation 16 #define ObjectBasicInformation 0 #define ObjectNameInformation 1 #define ObjectTypeInformation 2 typedef NTSTATUS(NTAPI *_NtQuerySystemInformation)( ULONG SystemInformationClass, PVOID SystemInformation, ULONG SystemInformationLength, PULONG ReturnLength ); typedef NTSTATUS(NTAPI *_NtDuplicateObject)( HANDLE SourceProcessHandle, HANDLE SourceHandle, HANDLE TargetProcessHandle, PHANDLE TargetHandle, ACCESS_MASK DesiredAccess, ULONG Attributes, ULONG Options ); typedef NTSTATUS(NTAPI *_NtQueryObject)( HANDLE ObjectHandle, ULONG ObjectInformationClass, PVOID ObjectInformation, ULONG ObjectInformationLength, PULONG ReturnLength ); typedef struct _UNICODE_STRING