2008-10-22 10 views
1

Windows DDK가있는 초보자를 용서해주세요. 나는이 같은 sources 파일 생성과 같은 디렉토리에Windows DDK로 컴파일 할 때 오류가 발생했습니다.

#include <windows.h> 

#define BAD_ADDRESS 0xBAADF00D 

int __cdecl main(int argc, char* args[]) 
{ 
    char* p =(char*)BAD_ADDRESS; 
    *p='A'; 
    return 0; 
} 

:

 
TARGETNAME=test 
TARGETTYPE=PROGRAM 
TARGETPATH=obj 

TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib 

SOURCES= test.cpp 

을 그리고이 같은 makefile :

 
# 
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source 
# file to this component. This file merely indirects to the real make file 
# that is shared by all the components of Windows 
# 
!INCLUDE $(NTMAKEENV)\makefile.def 

나는 test.cpp라는 간단한 파일을 만들 수 있습니다

Windows XP 무료 빌드 E를 시작한 후 nvironment 나는 세 개의 파일 (Test.cpp에, 메이크 파일 및 소스)와 디렉토리로 이동하여 다음 명령을 실행

F:\temp\debug\dir1>build -cZg

출력 :

 
BUILD: Adding /Y to COPYCMD so xcopy ops won't hang. 
BUILD: Using 2 child processes 
BUILD: Object root set to: ==> objfre_wxp_x86 
BUILD: Compile and Link for i386 
BUILD: Examining f:\temp\debug\dir1 directory for files to compile. 
BUILD: Compiling (NoSync) f:\temp\debug\dir1 directory 
1>Compiling - test.cpp for i386 
BUILD: Compiling f:\temp\debug\dir1 directory 
BUILD: Linking f:\temp\debug\dir1 directory 
1>Linking Executable - objfre_wxp_x86\i386\test.exe for i386 
BUILD: Done 

    2 files compiled 
    1 executable built 

문제는 내가를 실행할 때이다를 실행 파일 생성 test.exe는 말한다 : 나는 여기에 무엇을 놓치고

 
F:\temp\debug\dir1\objfre_wxp_x86\i386>test 
The F:\temp\debug\dir1\objfre_wxp_x86\i386\test.exe application cannot be run in Win32 mode. 

?

답변

2

Rob Walker 이유를 설명하는 이유는 Kernel Mustard입니다.

+0

이것은 작업을 수행 할 수있을만큼 충분히 가깝습니다. 그것이 힘들어도 받아 들일 수 있도록 설정하면 튜닝이 필요했습니다. –

+0

필요한 튜닝에 대해 설명해 주시겠습니까? –

+0

커널 겨자 링크가 이제 죽었습니다 :( – LnxPrgr3

3

win32 버전이 아닌 '기본 응용 프로그램'을 컴파일했습니다. TARGET_TYPE 정의가이를 제어합니다.

DDK를 사용하여 기본 응용 프로그램을 생성하는 방법에 대한 설명은 'Inside Native Applications'을 참조하십시오.

관련 문제