천객만래 [千客萬來] (It has an interminable succession of visitors)

LPSTR LPCTSTR 위험 CStrgin -> char 으로 변환




(LPSTR)(LPCTSTR)csTest은 위험하다.!!
-. 유니코드를 고려하지 않았을뿐 아니라
-. 위험하게 내부데이터를 접근합니다.
 
CString strPP;
char * chNN = (LPSTR)(LPCSTR)strPP;
이렇게 해서 chNN을 CString의 포인터로 가져 옵니다.

(LPSTR)(LPCSTR)strPP 이 부분 에서 이유는 MSDN을 찾아보시면 아시겠지만 CString은 const char * 으로 만 받을수 있답니다. 
그래서 (LPCTSTR)strPP 이런 형식으로도 사용합니다. 물론 const char *으로 return되겠죠.. 다시 char *을 필요하신다면  
char * chNN = (char *)(LPCTSTR)strPP; 이런 식으로도 사용합니다
 
char *pstr = (LPSTR)(LPCTSTR)str;        이 줄은 UNICODE인경우 
    char *pstr = (char *) (const wchar_t *) str;    입니다.
특히 wchar_t를 본래데이터형으로 보지 않을 경우
    char *pstr = (char *)(const unsigned short *)str;   입니다..
 
유니코드를 고려하지 않는다고 하더라도, CString이 제공하는 것은 const 가 붙은 형변환 밖에 없는데,
이걸 const 를 억지로 빼버리고는 마치 접근해서 고쳐도 되는 것처럼 보이게 되므로 
잘못사용하면 오류를 일으키며. 프로그램이 뻗을수도 있습니다.
 
const 변환은 받는 쪽에서 안고친다고 보고 CString이 자기 내부 메모리주소를 살짝 보여주는 건데.. 
그걸 char로 바꾸고 쓰려고 하면 당연히 에러가 발생 하겠죠...
보통 이런 문제는 char[50] 에서 처럼 .. "특정 위치의 글자를 바로 접근할 수 있냐..?"란 의문에서 생기는데 
이 문제는 CString만으로도 충분합니다.

CString이 operator[] 를 제공하고 있습니다.. operator를 이용 하면 됩니다.. 
str[23] 이렇게 마치 char[] 처럼 사용하실수 있습니다. 
물론 이때도 배열의 길이를 넘어서는 접근은 피해야 합니다.
C/C++의 배열이 제공못하는 길이를 CString은 GetLength()형태로 제공하니 얼마나 편합니까 .
출처:이상 데브피아
 
 
"이하" 파란 생각~
CString csTest = "사나이로 태어나서 할일은 사랑하기";
char* cTest = (LPSTR)(LPCTSTR)csTest;
AfxMessageBox(cTest);
 
즉, 위와 같이 무리한 형변환 보다는 CString의 Operator의 GetBuffer()을 사용해서 가지고오면 더욱 효율적입니다.
char* cTest;
CString csTest = "사나이로 태어나서 할일은 사랑하기";
cTest = csTest.GetBuffer(0);                //GetBuffer(0): csTest가 가지고 있는 문자열의 만큼 가지고 온다는 의미
AfxMessageBox(cTest);
 







Posted by SB패밀리

[개발/VC] xdebug, xlocale 관련 error

컴파일이나 빌드를 하면 xdebug, xlocale 관련 에러가 무지하게 많이 발생하는 경우가 생긴다.


이 에러는 다음과 같이 해결할 수 있다.

단 번에 해결이 안되더라도 꼼꼼하게 소스파일을 찾아서 수정해야한다.


#ifdef _DEBUG

#define new DEBUG_NEW

#endif


항상 .cpp 파일에서 위의 3줄 위에 #include 나 #pragma comment(lib, ...)를 선언해야 한다

Posted by SB패밀리
[개발/VC] 웹페이지 로드될 때까지 기다리기

m_pWebBrowser->Navigate(...); 로 페이지 호출 후 페이지가 로딩 완료될 때까지 기다리는 함수이다.

bool CMyInternetExplorer::WaitTillLoaded (int nTimeout)
{
    READYSTATE result;
    DWORD nFirstTick = GetTickCount ();

    do
    {
        m_pWebBrowser->get_ReadyState (&result);
        
        if (result != READYSTATE_COMPLETE)
            Sleep (250);
        
        if (nTimeout > 0)
        {
            if ((GetTickCount () - nFirstTick) > nTimeout)
                break;
        }
    } while (result != READYSTATE_COMPLETE);

    if (result == READYSTATE_COMPLETE)
        return true;
    else
        return false;
}
Posted by SB패밀리
[개발/VC] 엑티브엑스에서 키, 탭키등을 먹게 하기


////////////////////////////////////////////////////////////////////////
// ActiveX Control내 키 이벤트 문제
// 1. OnCreate에서 
//        OnActivateInPlace (TRUE, NULL); // == UI-Activate the control        
// 2. PreTranslateMessage 추가
// 3.  OnMouseActivate 추가
BOOL CActiveApprovalCtrl::PreTranslateMessage(MSG* pMsg) 
{
        // TODO: Add your specialized code here and/or call the base class
        switch (pMsg->message)
        {
                case WM_KEYDOWN:
                case WM_KEYUP:
                switch (pMsg->wParam)
                {
                        case VK_UP:
                        case VK_DOWN:
                        case VK_LEFT:
                        case VK_RIGHT:
                        case VK_HOME:
                        case VK_END:
                        case VK_TAB:                        // 탭키도 쓸수 있다.

                        ::SendMessage( pMsg->hwnd , pMsg->message, pMsg->wParam, pMsg->lParam);
                        //SendMessage (pMsg->message, pMsg->wParam, pMsg->lParam);
                        // Windowless controls won't be able to call SendMessage.
                        // Instead, just respond to the message here.
                        return TRUE;
                }
                break;
        }
        return COleControl::PreTranslateMessage(pMsg);
}

int CActiveApprovalCtrl::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) 
{
        // TODO: Add your message handler code here and/or call default
        if (!m_bUIActive)
                OnActivateInPlace (TRUE, NULL); // == UI-Activate the control
        return COleControl::OnMouseActivate(pDesktopWnd, nHitTest, message);
}

int CActiveApprovalCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
        if (COleControl::OnCreate(lpCreateStruct) == -1)
                return -1;
        OnActivateInPlace (TRUE, NULL); // == UI-Activate the control        

             :
        return 0;
}
//////////////////////////////////////////////////////////////////////////

Posted by SB패밀리
[개발/VC] ActiveX 컨트롤에서 자신을 로딩한 웹브라우저 포인터 구하기 

웹브라우저 컨트롤의 포인터를 넘깁니다..


    IWebBrowser2* CActiveXGetIETestCtrl::GetIWebPointer()
    {
        // TODO: Replace the following code with your own drawing code.
        HRESULT hr ;
        IOleContainer *pIContainer = NULL ;
        IWebBrowser2 *pIWeb = NULL ;
        IServiceProvider *pISP = NULL ;
        
        // Get IOleClientSite interface pointer.
        LPOLECLIENTSITE pIClientSite = GetClientSite() ;
        
        // Get IOleContainer interface poineter.
        hr = pIClientSite->GetContainer(&pIContainer) ;
        if (hr != S_OK) {
            pIClientSite->Release() ;
            return NULL ;
        }
        
        // Get IServiceProvider interface pointer.
        hr = pIClientSite->QueryInterface(IID_IServiceProvider,(void **)&pISP) ;
        if (hr != S_OK) {
            pIContainer->Release() ;
            pIClientSite->Release() ;
            return NULL ;
        }

        // Get IWebBrowser2 interface pointer.
        hr = pISP->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&pIWeb) ;
        if (hr != S_OK) {
            pIContainer->Release() ;
            pIClientSite->Release() ;
            pISP->Release() ;
            return NULL ;
        }
        
        // release interface.
        pIContainer->Release() ;
        pIClientSite->Release() ;
        pISP->Release() ;
        return pIWeb ;
    }



    여기서 얻어온 인터페이스 객체를 release 해주지 않았으므로
    ActiveX 컨트롤이 소멸될 때 반드시 해줘야 합니다..

    void CActiveXGetIETestCtrl::OnDestroy() 
    {
        COleControl::OnDestroy();
        
        // TODO: Add your message handler code here
        if (m_pIWeb)
            m_pIWeb->Release() ;
    }



    만약 포인터를 구해오는 멤버함수를 2번 이상 호출한다면
    호출한 횟수만큼 release를 호출해 줘야 합니다..

    제 예제에서는 1번만 호출하고 포인터를 멤버변수로 가지고 있으므로
    종료시 한번만 release 합니다..


    이렇게 얻어온 포인터를 활용해서 다른 URL로 이동,
    웹브라우저를 닫는 함수를 만들어봤습니다..

    IWebBrowser2 에서 지원하는 모든 메소드들은 다 호출할 수 있습니다..
    툴바를 숨긴다던지.. 뭐 맘대로 되겠죠..


    void CActiveXGetIETestCtrl::OnNavigate()
    {
        if (m_pIWeb)
        {
            CString sURL ;
            m_editURL.GetWindowText(sURL) ;
            COleVariant vaURL(sURL) ;
            m_pIWeb->Navigate2(vaURL,NULL,NULL,NULL,NULL) ;
        }
    }

    void CActiveXGetIETestCtrl::OnIEClose() 
    {
        if (m_pIWeb)
        {
            m_pIWeb->Quit() ;
        }
    }
Posted by SB패밀리
클릭했을때 이벤트 얻기

You may also have to include an entry in the dispatch map: (CHtmlEditView is
a class I have derived from CHtmlView )

BEGIN_DISPATCH_MAP(CHtmlEditView, CCmdTarget)
  DISP_FUNCTION_ID(CHtmlEditView, "onclick",
DISPID_HTMLDOCUMENTEVENTS_ONCLICK,
                                          OnClick, VT_BOOL, VTS_NONE)
END_DISPATCH_MAP()

VARIANT_BOOL CHtmlEditView::OnClick()
{
     MSHTML::IHTMLWindow2Ptr  spWin2;
     MSHTML::IHTMLEventObjPtr spEventObj;
     MSHTML::IHTMLElementPtr  spEle;
     MSHTML::IHTMLDocument2Ptr spDoc2 = NULL;

     m_pBrowserApp->get_Document( (IDispatch**)&spDoc2 );

     spWin2 = m_spDoc2->GetparentWindow();

     spEventObj = spWin2->Getevent();

     spEle = spEventObj->GetsrcElement(); // returns the element "clicked" on

    return VARIANT_TRUE;
}
Posted by SB패밀리
[개발/VC] 웹페이지 마우스 위치에 있는 엘리먼트 얻어오기

if (SUCCEEDED(hr))
   {
      IHTMLEventObj* pEvtObj;

      hr = pParentWindow->get_event(&pEvtObj);
      pParentWindow->Release();

      if (SUCCEEDED(hr))
      {
         long clientX = 0L, clientY = 0L;

         pEvtObj->get_clientX(&clientX);
         pEvtObj->get_clientY(&clientY);
         pEvtObj->Release();

   IHTMLElement* pHTMLElement = NULL;

   hr = pDocument->elementFromPoint(clientX, clientY, &pHTMLElement);
....
...
}
Posted by SB패밀리
// 인터넷 연결체크

// #include <wininet.h>
// #pragma comment(lib, "wininet.lib")

BOOL IsConnectedInternet()
{
DWORD dwFlag;
BOOL bChkInternet = InternetGetConnectedState(&dwFlags, 0);
if (!bChkInternet)
{
AfxMessageBox("It is not conntected to internet");
return FALSE;
}
return TRUE;
}

Posted by SB패밀리

GetLastError()함수로 얻게 되는 에러코드로 아래으 에러코드에 대한 에러 메세지의 의미를 알 수 있다.

 **System Error Codes (0-499)

The following table provides a list of
system error codes (
errors 0 to 499). They are returned by the
GetLastError
function when many functions fail. To retrieve the description text for the error in your application, use the
FormatMessage
function with the FORMAT_MESSAGE_FROM_SYSTEM flag.

Table with 2 columns and 209 rows

Constant/value
Description

ERROR_SUCCESS
0
The operation completed successfully.

ERROR_INVALID_FUNCTION
1
Incorrect function.

ERROR_FILE_NOT_FOUND
2
The system cannot find the file specified.

ERROR_PATH_NOT_FOUND
3
The system cannot find the path specified.

ERROR_TOO_MANY_OPEN_FILES
4
The system cannot open the file.

ERROR_ACCESS_DENIED
5
Access is denied.

ERROR_INVALID_HANDLE
6
The handle is invalid.

ERROR_ARENA_TRASHED
7
The storage control blocks were destroyed.

ERROR_NOT_ENOUGH_MEMORY
8
Not enough storage is available to process this command.

ERROR_INVALID_BLOCK
9
The storage control block address is invalid.

ERROR_BAD_ENVIRONMENT
10
The environment is incorrect.

ERROR_BAD_FORMAT
11
An attempt was made to load a program with an incorrect format.

ERROR_INVALID_ACCESS
12
The access code is invalid.

ERROR_INVALID_DATA
13
The data is invalid.

ERROR_OUTOFMEMORY
14
Not enough storage is available to complete this operation.

ERROR_INVALID_DRIVE
15
The system cannot find the drive specified.

ERROR_CURRENT_DIRECTORY
16
The directory cannot be removed.

ERROR_NOT_SAME_DEVICE
17
The system cannot move the file to a different disk drive.

ERROR_NO_MORE_FILES
18
There are no more files.

ERROR_WRITE_PROTECT
19
The media is write protected.

ERROR_BAD_UNIT
20
The system cannot find the device specified.

ERROR_NOT_READY
21
The device is not ready.

ERROR_BAD_COMMAND
22
The device does not recognize the command.

ERROR_CRC
23
Data error (cyclic redundancy check).

ERROR_BAD_LENGTH
24
The program issued a command but the command length is incorrect.

ERROR_SEEK
25
The drive cannot locate a specific area or track on the disk.

ERROR_NOT_DOS_DISK
26
The specified disk or diskette cannot be accessed.

ERROR_SECTOR_NOT_FOUND
27
The drive cannot find the sector requested.

ERROR_OUT_OF_PAPER
28
The printer is out of paper.

ERROR_WRITE_FAULT
29
The system cannot write to the specified device.

ERROR_READ_FAULT
30
The system cannot read from the specified device.

ERROR_GEN_FAILURE
31
A device attached to the system is not functioning.

ERROR_SHARING_VIOLATION
32
The process cannot access the file because it is being used by another process.

ERROR_LOCK_VIOLATION
33
The process cannot access the file because another process has locked a portion of the file.

ERROR_WRONG_DISK
34
The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1.

ERROR_SHARING_BUFFER_EXCEEDED
36
Too many files opened for sharing.

ERROR_HANDLE_EOF
38
Reached the end of the file.

ERROR_HANDLE_DISK_FULL
39
The disk is full.

ERROR_NOT_SUPPORTED
50
The request is not supported.

ERROR_REM_NOT_LIST
51
Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot
find the network path, contact your network administrator.

ERROR_DUP_NAME
52
You were not connected because a duplicate name exists on the network. Go to System in Control Panel to change the computer name and try again.

ERROR_BAD_NETPATH
53
The network path was not found.

ERROR_NETWORK_BUSY
54
The network is busy.

ERROR_DEV_NOT_EXIST
55
The specified network resource or device is no longer available.

ERROR_TOO_MANY_CMDS
56
The network BIOS command limit has been reached.

ERROR_ADAP_HDW_ERR
57
A network adapter hardware error occurred.

ERROR_BAD_NET_RESP
58
The specified server cannot perform the requested operation.

ERROR_UNEXP_NET_ERR
59
An unexpected network error occurred.

ERROR_BAD_REM_ADAP
60
The remote adapter is not compatible.

ERROR_PRINTQ_FULL
61
The printer queue is full.

ERROR_NO_SPOOL_SPACE
62
Space to store the file waiting to be printed is not available on the server.

ERROR_PRINT_CANCELLED
63
Your file waiting to be printed was deleted.

ERROR_NETNAME_DELETED
64
The specified network name is no longer available.

ERROR_NETWORK_ACCESS_DENIED
65
Network access is denied.

ERROR_BAD_DEV_TYPE
66
The network resource type is not correct.

ERROR_BAD_NET_NAME
67
The network name cannot be found.

ERROR_TOO_MANY_NAMES
68
The name limit for the local computer network adapter card was exceeded.

ERROR_TOO_MANY_SESS
69
The network BIOS session limit was exceeded.

ERROR_SHARING_PAUSED
70
The remote server has been paused or is in the process of being started.

ERROR_REQ_NOT_ACCEP
71
No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.

ERROR_REDIR_PAUSED
72
The specified printer or disk device has been paused.

ERROR_FILE_EXISTS
80
The file exists.

ERROR_CANNOT_MAKE
82
The directory or file cannot be created.

ERROR_FAIL_I24
83
Fail on INT 24.

ERROR_OUT_OF_STRUCTURES
84
Storage to process this request is not available.

ERROR_ALREADY_ASSIGNED
85
The local device name is already in use.

ERROR_INVALID_PASSWORD
86
The specified network password is not correct.

ERROR_INVALID_PARAMETER
87
The parameter is incorrect.

ERROR_NET_WRITE_FAULT
88
A write fault occurred on the network.

ERROR_NO_PROC_SLOTS
89
The system cannot start another process at this time.

ERROR_TOO_MANY_SEMAPHORES
100
Cannot create another system semaphore.

ERROR_EXCL_SEM_ALREADY_OWNED
101
The exclusive semaphore is owned by another process.

ERROR_SEM_IS_SET
102
The semaphore is set and cannot be closed.

ERROR_TOO_MANY_SEM_REQUESTS
103
The semaphore cannot be set again.

ERROR_INVALID_AT_INTERRUPT_TIME
104
Cannot request exclusive semaphores at interrupt time.

ERROR_SEM_OWNER_DIED
105
The previous ownership of this semaphore has ended.

ERROR_SEM_USER_LIMIT
106
Insert the diskette for drive %1.

ERROR_DISK_CHANGE
107
The program stopped because an alternate diskette was not inserted.

ERROR_DRIVE_LOCKED
108
The disk is in use or locked by another process.

ERROR_BROKEN_PIPE
109
The pipe has been ended.

ERROR_OPEN_FAILED
110
The system cannot open the device or file specified.

ERROR_BUFFER_OVERFLOW
111
The file name is too long.

ERROR_DISK_FULL
112
There is not enough space on the disk.

ERROR_NO_MORE_SEARCH_HANDLES
113
No more internal file identifiers available.

ERROR_INVALID_TARGET_HANDLE
114
The target internal file identifier is incorrect.

ERROR_INVALID_CATEGORY
117
The IOCTL call made by the application program is not correct.

ERROR_INVALID_VERIFY_SWITCH
118
The verify-on-write switch parameter value is not correct.

ERROR_BAD_DRIVER_LEVEL
119
The system does not support the command requested.

ERROR_CALL_NOT_IMPLEMENTED
120
This function is not supported on this system.

ERROR_SEM_TIMEOUT
121
The semaphore timeout period has expired.

ERROR_INSUFFICIENT_BUFFER
122
The data area passed to a system call is too small.

ERROR_INVALID_NAME
123
The filename, directory name, or volume label syntax is incorrect.

ERROR_INVALID_LEVEL
124
The system call level is not correct.

ERROR_NO_VOLUME_LABEL
125
The disk has no volume label.

ERROR_MOD_NOT_FOUND
126
The specified module could not be found.

ERROR_PROC_NOT_FOUND
127
The specified procedure could not be found.

ERROR_WAIT_NO_CHILDREN
128
There are no child processes to wait for.

ERROR_CHILD_NOT_COMPLETE
129
The %1 application cannot be run in Win32 mode.

ERROR_DIRECT_ACCESS_HANDLE
130
Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.

ERROR_NEGATIVE_SEEK
131
An attempt was made to move the file pointer before the beginning of the file.

ERROR_SEEK_ON_DEVICE
132
The file pointer cannot be set on the specified device or file.

ERROR_IS_JOIN_TARGET
133
A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.

ERROR_IS_JOINED
134
An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.

ERROR_IS_SUBSTED
135
An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.

ERROR_NOT_JOINED
136
The system tried to delete the JOIN of a drive that is not joined.

ERROR_NOT_SUBSTED
137
The system tried to delete the substitution of a drive that is not substituted.

ERROR_JOIN_TO_JOIN
138
The system tried to join a drive to a directory on a joined drive.

ERROR_SUBST_TO_SUBST
139
The system tried to substitute a drive to a directory on a substituted drive.

ERROR_JOIN_TO_SUBST
140
The system tried to join a drive to a directory on a substituted drive.

ERROR_SUBST_TO_JOIN
141
The system tried to SUBST a drive to a directory on a joined drive.

ERROR_BUSY_DRIVE
142
The system cannot perform a JOIN or SUBST at this time.

ERROR_SAME_DRIVE
143
The system cannot join or substitute a drive to or for a directory on the same drive.

ERROR_DIR_NOT_ROOT
144
The directory is not a subdirectory of the root directory.

ERROR_DIR_NOT_EMPTY
145
The directory is not empty.

ERROR_IS_SUBST_PATH
146
The path specified is being used in a substitute.

ERROR_IS_JOIN_PATH
147
Not enough resources are available to process this command.

ERROR_PATH_BUSY
148
The path specified cannot be used at this time.

ERROR_IS_SUBST_TARGET
149
An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.

ERROR_SYSTEM_TRACE
150
System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.

ERROR_INVALID_EVENT_COUNT
151
The number of specified semaphore events for DosMuxSemWait is not correct.

ERROR_TOO_MANY_MUXWAITERS
152
DosMuxSemWait did not execute; too many semaphores are already set.

ERROR_INVALID_LIST_FORMAT
153
The DosMuxSemWait list is not correct.

ERROR_LABEL_TOO_LONG
154
The volume label you entered exceeds the label character limit of the target file system.

ERROR_TOO_MANY_TCBS
155
Cannot create another thread.

ERROR_SIGNAL_REFUSED
156
The recipient process has refused the signal.

ERROR_DISCARDED
157
The segment is already discarded and cannot be locked.

ERROR_NOT_LOCKED
158
The segment is already unlocked.

ERROR_BAD_THREADID_ADDR
159
The address for the thread ID is not correct.

ERROR_BAD_ARGUMENTS
160
One or more arguments are not correct.

ERROR_BAD_PATHNAME
161
The specified path is invalid.

ERROR_SIGNAL_PENDING
162
A signal is already pending.

ERROR_MAX_THRDS_REACHED
164
No more threads can be created in the system.

ERROR_LOCK_FAILED
167
Unable to lock a region of a file.

ERROR_BUSY
170
The requested resource is in use.

ERROR_CANCEL_VIOLATION
173
A lock request was not outstanding for the supplied cancel region.

ERROR_ATOMIC_LOCKS_NOT_SUPPORTED
174
The file system does not support atomic changes to the lock type.

ERROR_INVALID_SEGMENT_NUMBER
180
The system detected a segment number that was not correct.

ERROR_INVALID_ORDINAL
182
The operating system cannot run %1.

ERROR_ALREADY_EXISTS
183
Cannot create a file when that file already exists.

ERROR_INVALID_FLAG_NUMBER
186
The flag passed is not correct.

ERROR_SEM_NOT_FOUND
187
The specified system semaphore name was not found.

ERROR_INVALID_STARTING_CODESEG
188
The operating system cannot run %1.

ERROR_INVALID_STACKSEG
189
The operating system cannot run %1.

ERROR_INVALID_MODULETYPE
190
The operating system cannot run %1.

ERROR_INVALID_EXE_SIGNATURE
191
Cannot run %1 in Win32 mode.

ERROR_EXE_MARKED_INVALID
192
The operating system cannot run %1.

ERROR_BAD_EXE_FORMAT
193
%1 is not a valid Win32 application.

ERROR_ITERATED_DATA_EXCEEDS_64k
194
The operating system cannot run %1.

ERROR_INVALID_MINALLOCSIZE
195
The operating system cannot run %1.

ERROR_DYNLINK_FROM_INVALID_RING
196
The operating system cannot run this application program.

ERROR_IOPL_NOT_ENABLED
197
The operating system is not presently configured to run this application.

ERROR_INVALID_SEGDPL
198
The operating system cannot run %1.

ERROR_AUTODATASEG_EXCEEDS_64k
199
The operating system cannot run this application program.

ERROR_RING2SEG_MUST_BE_MOVABLE
200
The code segment cannot be greater than or equal to 64K.

ERROR_RELOC_CHAIN_XEEDS_SEGLIM
201
The operating system cannot run %1.

ERROR_INFLOOP_IN_RELOC_CHAIN
202
The operating system cannot run %1.

ERROR_ENVVAR_NOT_FOUND
203
The system could not find the environment option that was entered.

ERROR_NO_SIGNAL_SENT
205
No process in the command subtree has a signal handler.

ERROR_FILENAME_EXCED_RANGE
206
The filename or extension is too long.

ERROR_RING2_STACK_IN_USE
207
The ring 2 stack is in use.

ERROR_META_EXPANSION_TOO_LONG
208
The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.

ERROR_INVALID_SIGNAL_NUMBER
209
The signal being posted is not correct.

ERROR_THREAD_1_INACTIVE
210
The signal handler cannot be set.

ERROR_LOCKED
212
The segment is locked and cannot be reallocated.

ERROR_TOO_MANY_MODULES
214
Too many dynamic-link modules are attached to this program or dynamic-link module.

ERROR_NESTING_NOT_ALLOWED
215
Cannot nest calls to LoadModule.

ERROR_EXE_MACHINE_TYPE_MISMATCH
216
The version of %1 is not compatible with the version you're running. Check your computer's system information to see whether you need a x86 (32-bit) or
x64 (64-bit) version of the program, and then contact the software publisher.

ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY
217
The image file %1 is signed, unable to modify.

ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY
218
The image file %1 is strong signed, unable to modify.

ERROR_FILE_CHECKED_OUT
220
This file is checked out or locked for editing by another user.

ERROR_CHECKOUT_REQUIRED
221
The file must be checked out before saving changes.

ERROR_BAD_FILE_TYPE
222
The file type being saved or retrieved has been blocked.

ERROR_FILE_TOO_LARGE
223
The file size exceeds the limit allowed and cannot be saved.

ERROR_FORMS_AUTH_REQUIRED
224
Access Denied. Before opening files in this location, you must first browse to the web site and select the option to login automatically.

ERROR_VIRUS_INFECTED
225
Operation did not complete successfully because the file contains a virus.

ERROR_VIRUS_DELETED
226
This file contains a virus and cannot be opened. Due to the nature of this virus, the file has been removed from this location.

ERROR_PIPE_LOCAL
229
The pipe is local.

ERROR_BAD_PIPE
230
The pipe state is invalid.

ERROR_PIPE_BUSY
231
All pipe instances are busy.

ERROR_NO_DATA
232
The pipe is being closed.

ERROR_PIPE_NOT_CONNECTED
233
No process is on the other end of the pipe.

ERROR_MORE_DATA
234
More data is available.

ERROR_VC_DISCONNECTED
240
The session was canceled.

ERROR_INVALID_EA_NAME
254
The specified extended attribute name was invalid.

ERROR_EA_LIST_INCONSISTENT
255
The extended attributes are inconsistent.

WAIT_TIMEOUT
258
The wait operation timed out.

ERROR_NO_MORE_ITEMS
259
No more data is available.

ERROR_CANNOT_COPY
266
The copy functions cannot be used.

ERROR_DIRECTORY
267
The directory name is invalid.

ERROR_EAS_DIDNT_FIT
275
The extended attributes did not fit in the buffer.

ERROR_EA_FILE_CORRUPT
276
The extended attribute file on the mounted file system is corrupt.

ERROR_EA_TABLE_FULL
277
The extended attribute table file is full.

ERROR_INVALID_EA_HANDLE
278
The specified extended attribute handle is invalid.

ERROR_EAS_NOT_SUPPORTED
282
The mounted file system does not support extended attributes.

ERROR_NOT_OWNER
288
Attempt to release mutex not owned by caller.

ERROR_TOO_MANY_POSTS
298
Too many posts were made to a semaphore.

ERROR_PARTIAL_COPY
299
Only part of a ReadProcessMemory or WriteProcessMemory request was completed.

ERROR_OPLOCK_NOT_GRANTED
300
The oplock request is denied.

ERROR_INVALID_OPLOCK_PROTOCOL
301
An invalid oplock acknowledgment was received by the system.

ERROR_DISK_TOO_FRAGMENTED
302
The volume is too fragmented to complete this operation.

ERROR_DELETE_PENDING
303
The file cannot be opened because it is in the process of being deleted.

ERROR_MR_MID_NOT_FOUND
317
The system cannot find message text for message number 0x%1 in the message file for %2.

ERROR_SCOPE_NOT_FOUND
318
The scope specified was not found.

ERROR_FAIL_NOACTION_REBOOT
350
No action was taken as a system reboot is required.

ERROR_FAIL_SHUTDOWN
351
The shutdown operation failed.

ERROR_FAIL_RESTART
352
The restart operation failed.

ERROR_MAX_SESSIONS_REACHED
353
The maximum number of sessions has been reached.

ERROR_INVALID_ADDRESS
487
Attempt to access invalid address.
table end

Requirements

Table with 2 columns and 3 rows

Client
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.

Server
Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server.

Header

Declared in Winerror.h.
table end

See Also

System Error Codes

  Last updated: December 2005  |
What did you think of this topic?  |
Order a Platform SDK CD
� Microsoft Corporation. All rights reserved. Terms of use.
Manage Your Profile |
Legal |
Contact Us |
MSDN Flash Newsletter
� 2005 Microsoft Corporation. All rights reserved.
Terms of Use |
Trademarks |
Privacy Statement
Microsoft

Requirements

Table with 2 columns and 3 rows

Client
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.

Server
Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server.

Header

Declared in Winerror.h.
table end
**System Error Codes (500-999)

The following table provides a list of
system error codes (
errors 500 to 999). These values are defined in the WinError.h header file. They are returned by the
GetLastError
function when many functions fail. To retrieve the description text for the error in your application, use the
FormatMessage
function with the FORMAT_MESSAGE_FROM_SYSTEM flag.

Table with 2 columns and 249 rows

Constant/value
Description

ERROR_USER_PROFILE_LOAD
500
User profile cannot be loaded.

ERROR_ARITHMETIC_OVERFLOW
534
Arithmetic result exceeded 32 bits.

ERROR_PIPE_CONNECTED
535
There is a process on other end of the pipe.

ERROR_PIPE_LISTENING
536
Waiting for a process to open the other end of the pipe.

ERROR_VERIFIER_STOP
537
Application verifier has found an error in the current process.

ERROR_ABIOS_ERROR
538
An error occured in the ABIOS subsystem.

ERROR_WX86_WARNING
539
A warning occured in the WX86 subsystem.

ERROR_WX86_ERROR
540
An error occured in the WX86 subsystem.

ERROR_TIMER_NOT_CANCELED
541
An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated
APC routine.

ERROR_UNWIND
542
Unwind exception code.

ERROR_BAD_STACK
543
An invalid or unaligned stack was encountered during an unwind operation.

ERROR_INVALID_UNWIND_TARGET
544
An invalid unwind target was encountered during an unwind operation.

ERROR_INVALID_PORT_ATTRIBUTES
545
Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort

ERROR_PORT_MESSAGE_TOO_LONG
546
Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port.

ERROR_INVALID_QUOTA_LOWER
547
An attempt was made to lower a quota limit below the current usage.

ERROR_DEVICE_ALREADY_ATTACHED
548
An attempt was made to attach to a device that was already attached to another device.

ERROR_INSTRUCTION_MISALIGNMENT
549
An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.

ERROR_PROFILING_NOT_STARTED
550
Profiling not started.

ERROR_PROFILING_NOT_STOPPED
551
Profiling not stopped.

ERROR_COULD_NOT_INTERPRET
552
The passed ACL did not contain the minimum required information.

ERROR_PROFILING_AT_LIMIT
553
The number of active profiling objects is at the maximum and no more may be started.

ERROR_CANT_WAIT
554
Used to indicate that an operation cannot continue without blocking for I/O.

ERROR_CANT_TERMINATE_SELF
555
Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process.

ERROR_UNEXPECTED_MM_CREATE_ERR
556
If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in
the filter. In this case information is lost, however, the filter correctly handles the exception.

ERROR_UNEXPECTED_MM_MAP_ERROR
557
If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in
the filter. In this case information is lost, however, the filter correctly handles the exception.

ERROR_UNEXPECTED_MM_EXTEND_ERR
558
If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in
the filter. In this case information is lost, however, the filter correctly handles the exception.

ERROR_BAD_FUNCTION_TABLE
559
A malformed function table was encountered during an unwind operation.

ERROR_NO_GUID_TRANSLATION
560
Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated
into a GUID that could be stored by the file system. This causes the protection attempt to fail, which may cause a file creation attempt to fail.

ERROR_INVALID_LDT_SIZE
561
Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors.

ERROR_INVALID_LDT_OFFSET
563
Indicates that the starting value for the LDT information was not an integral multiple of the selector size.

ERROR_INVALID_LDT_DESCRIPTOR
564
Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors.

ERROR_TOO_MANY_THREADS
565
Indicates a process has too many threads to perform the requested action. For example, assignment of a primary token may only be performed when a process
has zero or one threads.

ERROR_THREAD_NOT_IN_PROCESS
566
An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified.

ERROR_PAGEFILE_QUOTA_EXCEEDED
567
Page file quota was exceeded.

ERROR_LOGON_SERVER_CONFLICT
568
The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role.

ERROR_SYNCHRONIZATION_REQUIRED
569
The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required.

ERROR_NET_OPEN_FAILED
570
The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in
its internal error mapping routines.

ERROR_IO_PRIVILEGE_FAILED
571
{Privilege Failed} The I/O permissions for the process could not be changed.

ERROR_CONTROL_C_EXIT
572
{Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.

ERROR_MISSING_SYSTEMFILE
573
{Missing System File} The required system file %hs is bad or missing.

ERROR_UNHANDLED_EXCEPTION
574
{Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx.

ERROR_APP_INIT_FAILURE
575
{Application Error} The application failed to initialize properly (0x%lx). Click on OK to terminate the application.

ERROR_PAGEFILE_CREATE_FAILED
576
{Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld.

ERROR_INVALID_IMAGE_HASH
577
The hash for the image cannot be found in the system catalogs. The image is likely corrupt or the victim of tampering.

ERROR_NO_PAGEFILE
578
{No Paging File Specified} No paging file was specified in the system configuration.

ERROR_ILLEGAL_FLOAT_CONTEXT
579
{EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present.

ERROR_NO_EVENT_PAIR
580
An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated
with the thread.

ERROR_DOMAIN_CTRLR_CONFIG_ERROR
581
A Windows Server has an incorrect configuration.

ERROR_ILLEGAL_CHARACTER
582
An illegal character was encountered. For a multi-byte character set this includes a lead byte without a succeeding trail byte. For the Unicode character
set this includes the characters 0xFFFF and 0xFFFE.

ERROR_UNDEFINED_CHARACTER
583
The Unicode character is not defined in the Unicode character set installed on the system.

ERROR_FLOPPY_VOLUME
584
The paging file cannot be created on a floppy diskette.

ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT
585
The system bios failed to connect a system interrupt to the device or bus for which the device is connected.

ERROR_BACKUP_CONTROLLER
586
This operation is only allowed for the Primary Domain Controller of the domain.

ERROR_MUTANT_LIMIT_EXCEEDED
587
An attempt was made to acquire a mutant such that its maximum count would have been exceeded.

ERROR_FS_DRIVER_REQUIRED
588
A volume has been accessed for which a file system driver is required that has not yet been loaded.

ERROR_CANNOT_LOAD_REGISTRY_FILE
589
{Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable.

ERROR_DEBUG_ATTACH_FAILED
590
{Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request. You may choose OK to terminate
the process, or Cancel to ignore the error.

ERROR_SYSTEM_PROCESS_TERMINATED
591
{Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down.

ERROR_DATA_NOT_ACCEPTED
592
{Data Not Accepted} The TDI client could not handle the data received during an indication.

ERROR_VDM_HARD_ERROR
593
NTVDM encountered a hard error.

ERROR_DRIVER_CANCEL_TIMEOUT
594
{Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time.

ERROR_REPLY_MESSAGE_MISMATCH
595
{Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that
message.

ERROR_LOST_WRITEBEHIND_DATA
596
{Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost. This error may be caused by a failure of your computer
hardware or network connection. Please try to save this file elsewhere.

ERROR_CLIENT_SERVER_PARAMETERS_INVALID
597
The parameter(s) passed to the server in the client/server shared memory window were invalid. Too much data may have been put in the shared memory window.

ERROR_NOT_TINY_STREAM
598
The stream is not a tiny stream.

ERROR_STACK_OVERFLOW_READ
599
The request must be handled by the stack overflow code.

ERROR_CONVERT_TO_LARGE
600
Internal OFS status codes indicating how an allocation operation is handled. Either it is retried after the containing onode is moved or the extent stream
is converted to a large stream.

ERROR_FOUND_OUT_OF_SCOPE
601
The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation.

ERROR_ALLOCATE_BUCKET
602
The bucket array must be grown. Retry transaction after doing so.

ERROR_MARSHALL_OVERFLOW
603
The user/kernel marshalling buffer has overflowed.

ERROR_INVALID_VARIANT
604
The supplied variant structure contains invalid data.

ERROR_BAD_COMPRESSION_BUFFER
605
The specified buffer contains ill-formed data.

ERROR_AUDIT_FAILED
606
{Audit Failed} An attempt to generate a security audit failed.

ERROR_TIMER_RESOLUTION_NOT_SET
607
The timer resolution was not previously set by the current process.

ERROR_INSUFFICIENT_LOGON_INFO
608
There is insufficient account information to log you on.

ERROR_BAD_DLL_ENTRYPOINT
609
{Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly. The stack pointer has been left in an inconsistent state. The entrypoint
should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO may cause the application to operate
incorrectly.

ERROR_BAD_SERVICE_ENTRYPOINT
610
{Invalid Service Callback Entrypoint} The %hs service is not written correctly. The stack pointer has been left in an inconsistent state. The callback entrypoint
should be declared as WINAPI or STDCALL. Selecting OK will cause the service to continue operation. However, the service process may operate incorrectly.

ERROR_IP_ADDRESS_CONFLICT1
611
There is an IP address conflict with another system on the network

ERROR_IP_ADDRESS_CONFLICT2
612
There is an IP address conflict with another system on the network

ERROR_REGISTRY_QUOTA_LIMIT
613
{Low On Registry Space} The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored.

ERROR_NO_CALLBACK_ACTIVE
614
A callback return system service cannot be executed when no callback is active.

ERROR_PWD_TOO_SHORT
615
The password provided is too short to meet the policy of your user account. Please choose a longer password.

ERROR_PWD_TOO_RECENT
616
The policy of your user account does not allow you to change passwords too frequently. This is done to prevent users from changing back to a familiar, but
potentially discovered, password. If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned.

ERROR_PWD_HISTORY_CONFLICT
617
You have attempted to change your password to one that you have used in the past. The policy of your user account does not allow this. Please select a password
that you have not previously used.

ERROR_UNSUPPORTED_COMPRESSION
618
The specified compression format is unsupported.

ERROR_INVALID_HW_PROFILE
619
The specified hardware profile configuration is invalid.

ERROR_INVALID_PLUGPLAY_DEVICE_PATH
620
The specified Plug and Play registry device path is invalid.

ERROR_QUOTA_LIST_INCONSISTENT
621
The specified quota list is internally inconsistent with its descriptor.

ERROR_EVALUATION_EXPIRATION
622
{Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. To restore access
to this installation of Windows, please upgrade this installation using a licensed distribution of this product.

ERROR_ILLEGAL_DLL_RELOCATION
623
{Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. The relocation occurred because the DLL
%hs occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL.

ERROR_DLL_INIT_FAILED_LOGOFF
624
{DLL Initialization Failed} The application failed to initialize because the window station is shutting down.

ERROR_VALIDATE_CONTINUE
625
The validation process needs to continue on to the next step.

ERROR_NO_MORE_MATCHES
626
There are no more matches for the current index enumeration.

ERROR_RANGE_LIST_CONFLICT
627
The range could not be added to the range list because of a conflict.

ERROR_SERVER_SID_MISMATCH
628
The server process is running under a SID different than that required by client.

ERROR_CANT_ENABLE_DENY_ONLY
629
A group marked use for deny only can not be enabled.

ERROR_FLOAT_MULTIPLE_FAULTS
630
{EXCEPTION} Multiple floating point faults.

ERROR_FLOAT_MULTIPLE_TRAPS
631
{EXCEPTION} Multiple floating point traps.

ERROR_NOINTERFACE
632
The requested interface is not supported.

ERROR_DRIVER_FAILED_SLEEP
633
{System Standby Failed} The driver %hs does not support standby mode. Updating this driver may allow the system to go to standby mode.

ERROR_CORRUPT_SYSTEM_FILE
634
The system file %1 has become corrupt and has been replaced.

ERROR_COMMITMENT_MINIMUM
635
{Virtual Memory Minimum Too Low} Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file. During this process,
memory requests for some applications may be denied. For more information, see Help.

ERROR_PNP_RESTART_ENUMERATION
636
A device was removed so enumeration must be restarted.

ERROR_SYSTEM_IMAGE_BAD_SIGNATURE
637
{Fatal System Error} The system image %s is not properly signed. The file has been replaced with the signed file. The system has been shut down.

ERROR_PNP_REBOOT_REQUIRED
638
Device will not start without a reboot.

ERROR_INSUFFICIENT_POWER
639
There is not enough power to complete the requested operation.

ERROR_MULTIPLE_FAULT_VIOLATION
640
ERROR_MULTIPLE_FAULT_VIOLATION

ERROR_SYSTEM_SHUTDOWN
641
The system is in the process of shutting down.

ERROR_PORT_NOT_SET
642
An attempt to remove a processes DebugPort was made, but a port was not already associated with the process.

ERROR_DS_VERSION_CHECK_FAILURE
643
This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller.

ERROR_RANGE_NOT_FOUND
644
The specified range could not be found in the range list.

ERROR_NOT_SAFE_MODE_DRIVER
646
The driver was not loaded because the system is booting into safe mode.

ERROR_FAILED_DRIVER_ENTRY
647
The driver was not loaded because it failed it's initialization call.

ERROR_DEVICE_ENUMERATION_ERROR
648
The "%hs" encountered an error while applying power or reading the device configuration. This may be caused by a failure of your hardware or by a poor connection.

ERROR_MOUNT_POINT_NOT_RESOLVED
649
The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached.

ERROR_INVALID_DEVICE_OBJECT_PARAMETER
650
The device object parameter is either not a valid device object or is not attached to the volume specified by the file name.

ERROR_MCA_OCCURED
651
A Machine Check Error has occurred. Please check the system eventlog for additional information.

ERROR_DRIVER_DATABASE_ERROR
652
There was error [%2] processing the driver database.

ERROR_SYSTEM_HIVE_TOO_LARGE
653
System hive size has exceeded its limit.

ERROR_DRIVER_FAILED_PRIOR_UNLOAD
654
The driver could not be loaded because a previous version of the driver is still in memory.

ERROR_VOLSNAP_PREPARE_HIBERNATE
655
{Volume Shadow Copy Service} Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation.

ERROR_HIBERNATION_FAILURE
656
The system has failed to hibernate (The error code is %hs). Hibernation will be disabled until the system is restarted.

ERROR_FILE_SYSTEM_LIMITATION
665
The requested operation could not be completed due to a file system limitation

ERROR_ASSERTION_FAILURE
668
An assertion failure has occurred.

ERROR_ACPI_ERROR
669
An error occured in the ACPI subsystem.

ERROR_WOW_ASSERTION
670
WOW Assertion Error.

ERROR_PNP_BAD_MPS_TABLE
671
A device is missing in the system BIOS MPS table. This device will not be used. Please contact your system vendor for system BIOS update.

ERROR_PNP_TRANSLATION_FAILED
672
A translator failed to translate resources.

ERROR_PNP_IRQ_TRANSLATION_FAILED
673
A IRQ translator failed to translate resources.

ERROR_PNP_INVALID_ID
674
Driver %2 returned invalid ID for a child device (%3).

ERROR_WAKE_SYSTEM_DEBUGGER
675
{Kernel Debugger Awakened} the system debugger was awakened by an interrupt.

ERROR_HANDLES_CLOSED
676
{Handles Closed} Handles to objects have been automatically closed as a result of the requested operation.

ERROR_EXTRANEOUS_INFORMATION
677
{Too Much Information} The specified access control list (ACL) contained more information than was expected.

ERROR_RXACT_COMMIT_NECESSARY
678
This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted.
The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired).

ERROR_MEDIA_CHECK
679
{Media Changed} The media may have changed.

ERROR_GUID_SUBSTITUTION_MADE
680
{GUID Substitution} During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found.
A substitute prefix was used, which will not compromise system security. However, this may provide a more restrictive access than intended.

ERROR_STOPPED_ON_SYMLINK
681
The create operation stopped after reaching a symbolic link

ERROR_LONGJUMP
682
A long jump has been executed.

ERROR_PLUGPLAY_QUERY_VETOED
683
The Plug and Play query operation was not successful.

ERROR_UNWIND_CONSOLIDATE
684
A frame consolidation has been executed.

ERROR_REGISTRY_HIVE_RECOVERED
685
{Registry Hive Recovered} Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost.

ERROR_DLL_MIGHT_BE_INSECURE
686
The application is attempting to run executable code from the module %hs. This may be insecure. An alternative, %hs, is available. Should the application
use the secure module %hs?

ERROR_DLL_MIGHT_BE_INCOMPATIBLE
687
The application is loading executable code from the module %hs. This is secure, but may be incompatible with previous releases of the operating system.
An alternative, %hs, is available. Should the application use the secure module %hs?

ERROR_DBG_EXCEPTION_NOT_HANDLED
688
Debugger did not handle the exception.

ERROR_DBG_REPLY_LATER
689
Debugger will reply later.

ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE
690
Debugger can not provide handle.

ERROR_DBG_TERMINATE_THREAD
691
Debugger terminated thread.

ERROR_DBG_TERMINATE_PROCESS
692
Debugger terminated process.

ERROR_DBG_CONTROL_C
693
Debugger got control C.

ERROR_DBG_PRINTEXCEPTION_C
694
Debugger printed exception on control C.

ERROR_DBG_RIPEXCEPTION
695
Debugger received RIP exception.

ERROR_DBG_CONTROL_BREAK
696
Debugger received control break.

ERROR_DBG_COMMAND_EXCEPTION
697
Debugger command communication exception.

ERROR_OBJECT_NAME_EXISTS
698
{Object Exists} An attempt was made to create an object and the object name already existed.

ERROR_THREAD_WAS_SUSPENDED
699
{Thread Suspended} A thread termination occurred while the thread was suspended. The thread was resumed, and termination proceeded.

ERROR_IMAGE_NOT_AT_BASE
700
{Image Relocated} An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image.

ERROR_RXACT_STATE_CREATED
701
This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created.

ERROR_SEGMENT_NOTIFICATION
702
{Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. An exception is raised so a debugger
can load, unload or track symbols and breakpoints within these 16-bit segments.

ERROR_BAD_CURRENT_DIRECTORY
703
{Invalid Current Directory} The process cannot switch to the startup current directory %hs. Select OK to set current directory to %hs, or select CANCEL
to exit.

ERROR_FT_READ_RECOVERY_FROM_BACKUP
704
{Redundant Read} To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy. This was done
because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device.

ERROR_FT_WRITE_RECOVERY
705
{Redundant Write} To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information. This was done because
the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device.

ERROR_IMAGE_MACHINE_TYPE_MISMATCH
706
{Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail
the DLL load.

ERROR_RECEIVE_PARTIAL
707
{Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later.

ERROR_RECEIVE_EXPEDITED
708
{Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system.

ERROR_RECEIVE_PARTIAL_EXPEDITED
709
{Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system.
The remaining data will be sent later.

ERROR_EVENT_DONE
710
{TDI Event Done} The TDI indication has completed successfully.

ERROR_EVENT_PENDING
711
{TDI Event Pending} The TDI indication has entered the pending state.

ERROR_CHECKING_FILE_SYSTEM
712
Checking file system on %wZ

ERROR_FATAL_APP_EXIT
713
{Fatal Application Exit} %hs

ERROR_PREDEFINED_HANDLE
714
The specified registry key is referenced by a predefined handle.

ERROR_WAS_UNLOCKED
715
{Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process.

ERROR_SERVICE_NOTIFICATION
716
%hs

ERROR_WAS_LOCKED
717
{Page Locked} One of the pages to lock was already locked.

ERROR_LOG_HARD_ERROR
718
Application popup: %1 : %2

ERROR_ALREADY_WIN32
719
ERROR_ALREADY_WIN32

ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE
720
{Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine.

ERROR_NO_YIELD_PERFORMED
721
A yield execution was performed and no thread was available to run.

ERROR_TIMER_RESUME_IGNORED
722
The resumable flag to a timer API was ignored.

ERROR_ARBITRATION_UNHANDLED
723
The arbiter has deferred arbitration of these resources to its parent

ERROR_CARDBUS_NOT_SUPPORTED
724
The inserted CardBus device cannot be started because of a configuration error on "%hs".

ERROR_MP_PROCESSOR_MISMATCH
725
The CPUs in this multiprocessor system are not all the same revision level. To use all processors the operating system restricts itself to the features
of the least capable processor in the system. Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is
supported.

ERROR_HIBERNATED
726
The system was put into hibernation.

ERROR_RESUME_HIBERNATION
727
The system was resumed from hibernation.

ERROR_FIRMWARE_UPDATED
728
Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3].

ERROR_DRIVERS_LEAKING_LOCKED_PAGES
729
A device driver is leaking locked I/O pages causing system degradation. The system has automatically enabled tracking code in order to try and catch the
culprit.

ERROR_WAKE_SYSTEM
730
The system has awoken

ERROR_WAIT_1
731
ERROR_WAIT_1

ERROR_WAIT_2
732
ERROR_WAIT_2

ERROR_WAIT_3
733
ERROR_WAIT_3

ERROR_WAIT_63
734
ERROR_WAIT_63

ERROR_ABANDONED_WAIT_0
735
ERROR_ABANDONED_WAIT_0

ERROR_ABANDONED_WAIT_63
736
ERROR_ABANDONED_WAIT_63

ERROR_USER_APC
737
ERROR_USER_APC

ERROR_KERNEL_APC
738
ERROR_KERNEL_APC

ERROR_ALERTED
739
ERROR_ALERTED

ERROR_ELEVATION_REQUIRED
740
The requested operation requires elevation.

ERROR_REPARSE
741
A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.

ERROR_OPLOCK_BREAK_IN_PROGRESS
742
An open/create operation completed while an oplock break is underway.

ERROR_VOLUME_MOUNTED
743
A new volume has been mounted by a file system.

ERROR_RXACT_COMMITTED
744
This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted.
The commit has now been completed.

ERROR_NOTIFY_CLEANUP
745
This indicates that a notify change request has been completed due to closing the handle which made the notify change request.

ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED
746
{Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. The
computer WAS able to connect on a secondary transport.

ERROR_PAGE_FAULT_TRANSITION
747
Page fault was a transition fault.

ERROR_PAGE_FAULT_DEMAND_ZERO
748
Page fault was a demand zero fault.

ERROR_PAGE_FAULT_COPY_ON_WRITE
749
Page fault was a demand zero fault.

ERROR_PAGE_FAULT_GUARD_PAGE
750
Page fault was a demand zero fault.

ERROR_PAGE_FAULT_PAGING_FILE
751
Page fault was satisfied by reading from a secondary storage device.

ERROR_CACHE_PAGE_LOCKED
752
Cached page was locked during operation.

ERROR_CRASH_DUMP
753
Crash dump exists in paging file.

ERROR_BUFFER_ALL_ZEROS
754
Specified buffer contains all zeros.

ERROR_REPARSE_OBJECT
755
A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.

ERROR_RESOURCE_REQUIREMENTS_CHANGED
756
The device has succeeded a query-stop and its resource requirements have changed.

ERROR_TRANSLATION_COMPLETE
757
The translator has translated these resources into the global space and no further translations should be performed.

ERROR_NOTHING_TO_TERMINATE
758
A process being terminated has no threads to terminate.

ERROR_PROCESS_NOT_IN_JOB
759
The specified process is not part of a job.

ERROR_PROCESS_IN_JOB
760
The specified process is part of a job.

ERROR_VOLSNAP_HIBERNATE_READY
761
{Volume Shadow Copy Service} The system is now ready for hibernation.

ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY
762
A file system or file system filter driver has successfully completed an FsFilter operation.

ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED
763
The specified interrupt vector was already connected.

ERROR_INTERRUPT_STILL_CONNECTED
764
The specified interrupt vector is still connected.

ERROR_WAIT_FOR_OPLOCK
765
An operation is blocked waiting for an oplock.

ERROR_DBG_EXCEPTION_HANDLED
766
Debugger handled exception

ERROR_DBG_CONTINUE
767
Debugger continued

ERROR_CALLBACK_POP_STACK
768
An exception occurred in a user mode callback and the kernel callback frame should be removed.

ERROR_COMPRESSION_DISABLED
769
Compression is disabled for this volume.

ERROR_CANTFETCHBACKWARDS
770
The data provider cannot fetch backwards through a result set.

ERROR_CANTSCROLLBACKWARDS
771
The data provider cannot scroll backwards through a result set.

ERROR_ROWSNOTRELEASED
772
The data provider requires that previously fetched data is released before asking for more data.

ERROR_BAD_ACCESSOR_FLAGS
773
The data provider was not able to intrepret the flags set for a column binding in an accessor.

ERROR_ERRORS_ENCOUNTERED
774
One or more errors occurred while processing the request.

ERROR_NOT_CAPABLE
775
The implementation is not capable of performing the request.

ERROR_REQUEST_OUT_OF_SEQUENCE
776
The client of a component requested an operation which is not valid given the state of the component instance.

ERROR_VERSION_PARSE_ERROR
777
A version number could not be parsed.

ERROR_BADSTARTPOSITION
778
The iterator's start position is invalid.

ERROR_MEMORY_HARDWARE
779
The hardware has reported an uncorrectable memory error.

ERROR_DISK_REPAIR_DISABLED
780
The attempted operation required self healing to be enabled.

ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE
781
The Desktop heap encountered an error while allocating session memory. There is more information in the system event log.

ERROR_SYSTEM_POWERSTATE_TRANSITION
782
The system powerstate is transitioning from %2 to %3.

ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION
783
The system powerstate is transitioning from %2 to %3 but could enter %4.

ERROR_MCA_EXCEPTION
784
A thread is getting dispatched with MCA EXCEPTION because of MCA.

ERROR_ACCESS_AUDIT_BY_POLICY
785
Access to %1 is monitored by policy rule %2.

ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY
786
Access to %1 has been restricted by your Administrator by policy rule %2.

ERROR_EA_ACCESS_DENIED
994
Access to the extended attribute was denied.

ERROR_OPERATION_ABORTED
995
The I/O operation has been aborted because of either a thread exit or an application request.

ERROR_IO_INCOMPLETE
996
Overlapped I/O event is not in a signaled state.

ERROR_IO_PENDING
997
Overlapped I/O operation is in progress.

ERROR_NOACCESS
998
Invalid access to memory location.

ERROR_SWAPERROR
999
Error performing inpage operation.

Posted by SB패밀리



파일을 열고 닫기
 
HANDLE hFile;
hFile = CreateFile("File.txt", GENERIC_READ | GENERIC_WRITE,
         FILE_SHARED_READ, NULL, OPEN_ALWAYS,
         FILE_ATTRIBUTE_NORMAL, NULL);
 
if(hFile != INVALID_HANDLE_VALUE)
{
     //파일을 사용한다.
 
     //파일을 닫는다.
     CloseHandle(hFile);
}


파일을 읽거나 쓰기
 
HANDLE hFile;
hFile = CreateFile("File.txt", GENERIC_READ | GENERIC_WRITE,
         FILE_SHARED_READ, NULL, OPEN_ALWAYS,
         FILE_ATTRIBUTE_NORMAL, NULL);
 
if(hFile != INVALID_HANDLE_VALUE)
{
     DWORD dwActBytes;
     char szBuf[128];
 
     //''This is a sample" 문자열을 파일에 쓴다.
     WriteFile(hFile, "This is a sample", 17, &dwActBytes, NULL);
 
     //파일 포인터를 파일의 시작 위치로 옮긴다.
     SetFilePointer(hFile, 0, 0, FILE_BEGIN);
 
     //파일로부터 문자열을 읽어온다.
     ReadFile(hFile, szBuf, 128, &dwActBytes, NULL);
 
     //NULL로 끝나는 문자열.
     szBuf[dwActBytes] = 0;
     //파일을 닫는다.
     CloseHandle(hFile);
}

 

Posted by SB패밀리

[개발/VC] xdebug, xlocale 관련 error

컴파일이나 빌드를 하면 xdebug, xlocale 관련 에러가 무지하게 많이 발생하는 경우가 생긴다.

이 에러는 다음과 같이 해결할 수 있다.
단 번에 해결이 안되더라도 꼼꼼하게 소스파일을 찾아서 수정해야한다.

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

항상 .cpp 파일에서 위의 3줄 위에 #include 나 #pragma comment(lib, ...)를 선언해야 한다.


쌈꼬쪼려 소백촌닭
Posted by SB패밀리

(LPSTR)(LPCTSTR)csTest은 위험하다.!!
-. 유니코드를 고려하지 않았을뿐 아니라
-. 위험하게 내부데이터를 접근합니다.
 
CString strPP;
char * chNN = (LPSTR)(LPCSTR)strPP;
이렇게 해서 chNN을 CString의 포인터로 가져 옵니다.

(LPSTR)(LPCSTR)strPP 이 부분 에서 이유는 MSDN을 찾아보시면 아시겠지만 CString은 const char * 으로 만 받을수 있답니다.
그래서 (LPCTSTR)strPP 이런 형식으로도 사용합니다. 물론 const char *으로 return되겠죠.. 다시 char *을 필요하신다면 
char * chNN = (char *)(LPCTSTR)strPP; 이런 식으로도 사용합니다
 
char *pstr = (LPSTR)(LPCTSTR)str;        이 줄은 UNICODE인경우
    char *pstr = (char *) (const wchar_t *) str;    입니다.
특히 wchar_t를 본래데이터형으로 보지 않을 경우
    char *pstr = (char *)(const unsigned short *)str;   입니다..
 
유니코드를 고려하지 않는다고 하더라도, CString이 제공하는 것은 const 가 붙은 형변환 밖에 없는데,
이걸 const 를 억지로 빼버리고는 마치 접근해서 고쳐도 되는 것처럼 보이게 되므로
잘못사용하면 오류를 일으키며. 프로그램이 뻗을수도 있습니다.
 
const 변환은 받는 쪽에서 안고친다고 보고 CString이 자기 내부 메모리주소를 살짝 보여주는 건데..
그걸 char로 바꾸고 쓰려고 하면 당연히 에러가 발생 하겠죠...
보통 이런 문제는 char[50] 에서 처럼 .. "특정 위치의 글자를 바로 접근할 수 있냐..?"란 의문에서 생기는데
이 문제는 CString만으로도 충분합니다.

CString이 operator[] 를 제공하고 있습니다.. operator를 이용 하면 됩니다..
str[23] 이렇게 마치 char[] 처럼 사용하실수 있습니다.
물론 이때도 배열의 길이를 넘어서는 접근은 피해야 합니다.
C/C++의 배열이 제공못하는 길이를 CString은 GetLength()형태로 제공하니 얼마나 편합니까 .
출처:이상 데브피아
 
 
"이하" 파란 생각~
CString csTest = "사나이로 태어나서 할일은 사랑하기";
char* cTest = (LPSTR)(LPCTSTR)csTest;
AfxMessageBox(cTest);
 
즉, 위와 같이 무리한 형변환 보다는 CString의 Operator의 GetBuffer()을 사용해서 가지고오면 더욱 효율적입니다.
char* cTest;
CString csTest = "사나이로 태어나서 할일은 사랑하기";
cTest = csTest.GetBuffer(0);                //GetBuffer(0): csTest가 가지고 있는 문자열의 만큼 가지고 온다는 의미
AfxMessageBox(cTest);

출처 : http://blog.daum.net/sjdody/5693925
Posted by SB패밀리