'Win32'에 해당되는 글 2건

  1. 2014.05.13 NSIS로 64비트용 설치파일 만들때 팁
  2. 2013.08.19 Windows Management Instrumentation (WMI) Client for Linux (3)
2014. 5. 13. 18:46

NSIS로 64비트용 설치파일 만들때 팁


64비트용 프로그램을 만드셨습니까? NSIS 로 설치파일을 만드려고 하시나요?

이럴때 유용한 팁을 소개합니다.

1. UNICODE NSIS 설치 : http://www.scratchpaper.com/ 

WIN95/98 을 지원하지 않는다고 할때 UNICODE NSIS 를 사용하면 설치파일의 다국어 지원등에

매우 유리합니다. 물론 64비트 OS 는 전부 유니코드 지원 OS 죠. 

2. Program files 폴더

nsis 에서 program files 폴더 변수는 $PROGRAMFILES 입니다. 

그런데 64비트 os 에서는 $PROGRAMFILES 는 program files (x86) 이 되어 버리죠.

64비트용 프로그램을 program files 에 설치하고 싶으면 $PROGRAMFILES64 사용하면 됩니다.

$PROGRAMFILES64 변수는 32비트 os 에서도 program files 입니다.

3. 레지스트리 접근

64비트 os 는 32비트용 프로그램이 직접적으로 64비트 os 용 레지스트리에 접근하는걸 막습니다.

마찬가지로 nsis 스크립트의 설치파일도 그냥 쓰면 64비트용 레지스트리에 접근이 안되기 때문에

64비트용 레지스트리에 접근하기 위해서는 

SetRegView   64

를 써 줘야만 합니다.

4. 런타임에 64비트 os 여부 확인 

32비트 바이너리와 64비트 바이너리를 한 설치파일에 집어넣고자 할 경우가 있습니다.

이런 경우 런타임에 현재 os 가 64 비트인지 아닌지 확인하려면 다음과 같은 방식으로 코드를 사용하면 됩니다.

   ; 64비트 여부 체크하기   
   System::Call "kernel32::GetCurrentProcess() i .s"
   System::Call "kernel32::IsWow64Process(i s, *i .r0)"
   StrCmp $0 '0' Win32 Win64
      File /oname=name.exe  name32.exe
      Goto EndCheck
      File /oname=name.exe  name64.exe

출처 : 독립 개발자 네트워크

Trackback 0 Comment 0
2013. 8. 19. 14:29

Windows Management Instrumentation (WMI) Client for Linux


If you don’t want to install external monitoring application to your Windows, the easiest way to monitor it is to use WMI (Windows Managament Instrumentation).
This is an infrastructure for management data and operations on Windows-based operating systems and it is available by default from Windows 2000 through Windows 7 to Windows 2008 R2.
For more details about WMI see the following pages:

Windows Managament Instrumentation on WIKI
Windows Managament Instrumentation on MSDN

For example, using WMI you can query the running processes or services from your remote server running Windows-based operating system or get a lot of important information about this host.

It sounds good, doesn’t it? But there is a problem on Linux, you need a WMI client if you want to monitor your Windows but this is not available on the most distributions by default.
On Ubuntu, you can download it from ubuntu packages, but only for Hardy: http://packages.ubuntu.com/hardy/wmi-client
Unfortunately, this version does not work with Windows Vista or above.
If you try to to run a query to Vista or Windows 7, you will receive the following error message:

ERROR: WMI query execute.
NTSTATUS: NT code 0xc002001b – NT code 0xc002001b

Also, this package is not available above Hardy because it has been removed because of licensing problem: link

So, if you want to use this useful wmi client (it’s free under GPLv2), you need to dowload it from Zenoss website and compile it for yourself.
It is very easy:
Download wmi client from zenoss repository or just use this link (perhaps it will be changed if newer version will be available):
wmi-client 1.3.13


tar xvf wmi-1.3.13.tar.bz2
cd wmi-1.3.13
export ZENHOME=<yourpath>/wmi-zenoss/wmi-1.3.13

After compiling has finished, you can find wmi client(wmic) in wmi-1.3.13/Samba/source/bin directory. I tried it on my Ubuntu Lucid and worked very well.

Now, let’s see a few examples:

To query processes that are running on my remote Windows 7 (Note: you should give the correct domainname,username and password of your system):

./wmic -U <domainname>/<username>%<password> // “SELECT CommandLine,Name,ProcessId FROM Win32_Process”

CLASS: Win32_Process
“C:Windowssystem32cmd.exe” |3512|cmd.exe|3512

To query running services:

./wmic -U  <domainname>/<username>%<password> // “SELECT Caption,CreationClassName,DisplayName,Name,PathName,ProcessId,State,ServiceType FROM Win32_Service WHERE State=’Running’”

CLASS: Win32_Service
Security Accounts Manager|Win32_Service|Security Accounts Manager|SamSs|C:Windowssystem32lsass.exe|436|Share Process|Running
RPC Endpoint Mapper|Win32_Service|RPC Endpoint Mapper|RpcEptMapper|C:Windowssystem32svchost.exe -k RPCSS|628|Share Process|Running

Or just to query disk capacity of “C:”:

./wmic -U <domainname>/<username>%<password> // “SELECT DriveLetter,Capacity,FileSystem,FreeSpace FROM Win32_Volume WHERE DriveLetter=’C:’”

CLASS: Win32_Volume

As you can see, these are just  simple queries like SQL, but WMI uses WQL (WMI Query Language) and you can also use “*” wildcard to query all fields.
For more details about WQL: Link

Also, you should know the available WMI classess (like Win32_Volume or Win32_Service in my examples):WMI classes

Now, you are able to monitor your Windows-based servers with WMI from Linux, too. Have fun!

출처 : pzolee.blogs.balabit.com

Trackback 0 Comment 3
  1. Favicon of https://blog.pages.kr 날으는물고기 2013.08.19 14:53 신고 address edit & del reply

    use strict;
    use warnings;

    use Win32::OLE;
    use Win32::OLE::Variant;


    my $wmi = Win32::OLE->GetObject('winmgmts:\\\\SYSTEM\root\cimv2') or die Win32::OLE->LastError;
    my $list = $wmi->ExecQuery('SELECT * FROM Win32_PerfFormattedData_Counters_ProcessorInformation');
    my $n = 0;
    for my $cpu (in $list) {
    printf "%s: %d%%\n", $n ? "CPU$n" : ' ALL', $cpu->PercentProcessorTime;

  2. Favicon of https://blog.pages.kr 날으는물고기 2013.08.19 14:53 신고 address edit & del reply


    ALL: 8%
    CPU1: 8%
    CPU2: 12%
    CPU3: 6%
    CPU4: 12%
    CPU5: 6%
    CPU6: 6%
    CPU7: 6%

  3. 2013.10.24 20:07 address edit & del reply