我想写一个枚举硬盘分区的dll,代码如下enumpartition.h
#ifndef _ENUMPARTITION_H_
#define _ENUMPARTITION_H_
#define DLLIMPORT __declspec (dllexport)
typedef struct _EtParition
{
CHAR *path;
} EtPartition;
EtPartition et_pis[20];
ULONG et_np=0;
DLLIMPORT ULONG et_init();
DLLIMPORT CHAR* et_path(ULONG i);
DLLIMPORT UCHAR et_type(ULONG i);
DLLIMPORT LONGLONG et_size(ULONG i);
#endif
enumpartition.c
#include
#include
#include
#include
#include // Guid definition
#include // Device guids
#include // for SetupDiXxx functions.
#include // for SetupDiXxx functions.
#include
#include
#include
#include
BOOL APIENTRY DllMain(HINSTANCE hInstance,
DWORD reason,
{
return TRUE;
}
BOOL GetDeviceProperty(HDEVINFO IntDevInfo, DWORD Index )
{
SP_DEVICE_INTERFACE_DATA interfaceData;
}
DLLIMPORT ULONG et_init()
{
HDEVINFO hDevInfo, hIntDevInfo;
}
DLLIMPORT CHAR* et_path(ULONG i)
{
if(i>=et_np)return NULL;
}
DLLIMPORT UCHAR et_type(ULONG i)
{
if(i>=et_np)return NULL;
}
DLLIMPORT LONGLONG et_size(ULONG i)
{
if(i>=et_np)return NULL;
}
sources
TARGETNAME=enumpartition
TARGETTYPE=DYNLINK
TARGETPATH=obj
TARGETLIBS=$(DDK_LIB_PATH)\setupapi.lib
INCLUDES=$(BASEDIR)\inc;
SOURCES=enumpartition.c
我在ddk的build环境下用build编译,却出现如下错误
BUILD: Adding /Y to COPYCMD so xcopy ops won't hang.
BUILD: Object root set to: ==> objchk_wxp_x86
BUILD: Compile and Link for i386
BUILD: Loading C:\WINDDK\3790\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Examining d:\enumpartition directory for files to compile.
d:\enumpartition - 1 source files (166 lines)
BUILD: Compiling d:\enumpartition directory
Compiling - enumpartition.c for i386
NMAKE : U1073: don't know how to make 'enumpartition.def'
BUILD: nmake.exe failed - rc = 2
BUILD: Compile errors: not linking d:\enumpartition directory
BUILD: Done
2 files compiled - 2 Warnings - 1 Error - 166 LPS
阅读(1057) | 评论(0) | 转发(1) |