Create TOC

2007년 11월 18일

Debian/ntfs-3g 설정

이 문서는 Debian 에서 ntfs-3g 를 이용해서 NTFS를 읽고/쓰는 방법을 기술한다.

사용자 Locale 은 ko_KR.UTF-8 로 되어 있다고 가정한다.

준비

ntfs-3g 설치

$ apt-get install ntfs-3g

권한 할당

$ adduser 사용자id fuse

mount

/dev/sda2를 /mnt/data에 mount한다고 가정한다.

수동

$ sudo ntfs-3g /dev/sda2 /mnt/data -o locale=ko_KR.UTF-8

또는

$ sudo mount -t ntfs-3g /dev/sda2 /mnt/data -o locale=ko_KR.UTF-8

/etc/fstab를 시용한 방법

/etc/fstab 파일에 아래 내용을 추가하면 부팅 할 때 자동으로 mount 한다.

/dev/sda2 /mnt/data  ntfs-3g defaults,locale=ko_KR.UTF-8 0 0

그러나 SATA와 PATA를 섞어쓸 경우 device 순서가 바뀔 수 있기 때문에 UUID를 사용하는 것이 좋다. UUID확인은 아래와 같이 할 수 있다2010-02-09 추가.

$ ls -l /dev/disk/by-uuid/
합계 0
lrwxrwxrwx 1 root root 10 2010-02-09 23:34 283CEB2F3CEAF6AA -> ../../sdh1
lrwxrwxrwx 1 root root 10 2010-02-09 22:19 43db6442-39b4-4397-ab1a-dc7bb0af5412 -> ../../sdc1
lrwxrwxrwx 1 root root 10 2010-02-09 22:18 50ae33c6-f577-4dc0-a592-a367b2d031c6 -> ../../sda3
lrwxrwxrwx 1 root root 10 2010-02-09 22:19 85dc613d-1369-4434-99dc-cbd7e3838888 -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-02-09 22:19 ac83e3b9-bc20-43f4-bd79-21a703726564 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2010-02-09 22:19 f4e15ba6-b01e-4e48-80c7-ba1c7c916fd4 -> ../../sda4
lrwxrwxrwx 1 root root 10 2010-02-09 22:19 fa23b4da-582a-4001-971d-8fbbca8f0dcf -> ../../sda2

장치에 맞는 UUID를 확인한 다음 아래와 같이 /etc/fstab파일을 수정한다.

UUID=fa23b4da-582a-4001-971d-8fbbca8f0dcf /mnt/data  ntfs-3g defaults,locale=ko_KR.UTF-8 0 0

To create a notification thread and then return

int WINAPI _tWinMain(HINSTANCE hinstExe, HINSTANCE, PTSTR pszCmdLine, int) {

    // Create our events for event logging notification as well as our event for ending the notification thread
    g_evtNewEventLogRecord = CreateEvent(NULL, TRUE, FALSE, NULL);
    HANDLE hThread = chBEGINTHREADEX(NULL, 0, EventNotifyThread, NULL, 0, NULL);

    DialogBox(hinstExe, MAKEINTRESOURCE(IDD_EVENTMONITOR), NULL, Dlg_Proc);

    // Clean up
    QueueUserAPC(DoNothingAPC, hThread, NULL);
    WaitForSingleObject(hThread, INFINITE);
    CloseHandle(g_evtNewEventLogRecord);
    CloseHandle(hThread);
    return(0);
}

///////////////////////////////////////////////////////////////////////////////
DWORD WINAPI EventNotifyThread(PVOID pvParam) {

    // Note that this is not the thread that called NotifyChangeEventLog.
    // The main thread does this in response to the WM_INITDIALOG message.
    // If the main thread were to terminate before this thread, then
    // notifications would cease to function. However, since it will always
    // terminate after this thread, then we can count on the notification event
    // working properly.

    // Wait for an event notification or for APC altering this thread to termiante.
    while (WaitForSingleObjectEx(g_evtNewEventLogRecord, INFINITE, TRUE) != WAIT_IO_COMPLETION) {
        FORWARD_WM_USERNOTIFYUPDATE(g_hwnd, PostMessage);
    }

    // We got an APC, this thread should terminate
    return(0);
}

Comparing Memory Allocation Methods

This topic provides a brief comparison of the following memory allocation methods:

  • CoTaskMemAlloc
  • GlobalAlloc
  • HeapAlloc
  • LocalAlloc
  • malloc
  • new
  • VirtualAlloc

The following functions are equivalent: GlobalAlloc, LocalAlloc, and HeapAlloc with the handle returned by the GetProcessHeap function.

The VirtualAlloc function allows you to specify additional options for memory allocation. However, its allocations use a page granularity, so using VirtualAlloc can result in higher memory usage.

The malloc function has the disadvantage of being run-time dependent. The new operator has the disadvantage of being compiler dependent and language dependent.

The CoTaskMemAlloc function has the advantage of working well in either C, C++, or Visual Basic. It is also the only way to share memory in a COM-based application, since MIDL uses CoTaskMemAlloc and CoTaskMemFree to marshal memory.

Windows 2000 에서 Network 설정 변경

Win2k 에서 Network 설정 변경

  • INetCfg COM 사용
  • INetCfg COM 사용2
  • WMI 사용
  • Q162771: Installing Network Components Without the Control Panel
  • Q185783: SAMPLE: IPInst.exe Determines Whether TCP/IP is Installed
  • Q120642: TCP/IP & NBT Configuration Parameters for Windows NT

2007년 11월 15일

Debian/MS Laser 5000 Mouse 설정

이 문서는 Debian 에서 MS Laser 5000 Mouse 를 설정하는 방법을 다루고 있다. Desktop 환경은 GNOME 을 사용하는 것을 전제로 한다.

필요한 package 설치

$ sudo apt-get install xvkbd xbindkeys

설정

X-window

/etc/X11/xorg.conf에 아래처럼 마우스 설정을 한다.

Section "ServerLayout"
    InputDevice    "MS Laser 5000" "CorePointer"
EndSection

Section "InputDevice"
    Identifier  "MS Laser 5000"
    Driver      "evdev"
    Option      "Device" "/dev/input/event1"
    Option      "Protocol" "ExplorerPS/2"
    Option      "Buttons" "12"
    Option      "ZAxisMapping" "6 7"
    Option      "Emulate3Buttons" "no"
    Option      "SendCoreEvents" "yes"
EndSection

버튼 설정

휠 스크롤은 기본으로 설정되지만 back, forard, tilt-left 그리고 tilt-right는 별도의 설정을 해야 한다.

~/.xbindkeysrc

# tilt-right button
"xvkbd -xsendevent -text "\[Right]""
m:0x0 + b:6

# tilt-left button
"xvkbd -xsendevent -text "\[Left]""
m:0x0 + b:7

# back button
"xvkbd -xsendevent -text "\[Alt_L]\[Left]""
m:0x0 + b:8

# forward button
"xvkbd -xsendevent -text "\[Alt_L]\[Right]""
m:0x0 + b:9

세션 설정

시스템 - 기본 설정 - 세션xbindkeys를 등록한다.

2007년 2월 5일

Win32/Critical section에 대한 몇 가지 주의 사항

시스템 가용 메모리 부족시

문제

InitializeCriticalSection()함수를 이용해서 만들어진 critical section은 시스템의 가용메모리가 부족하면 EnterCriticalSection()할때 system exception이 발생하게 된다.

해결

InitializeCriticalSection() 함수 대신 InitializeCriticalSectionAndSpinCount() 함수를 사용한다. 단순하게 SEH를 사용하면 될 것 같지만 SEH는 문제를 해결해 주기 보다는 감추는 경우가 많기 때문에 되도록 사용하지 않는 것이 좋다.

Vista에서 제한점

critical section으로 lock걸린 구역안에서 Sleep() 함수를 사용하면 안된다.