首页
社区
课程
招聘
[求助]如何历遍电脑上的磁盘?
发表于: 2006-12-18 03:36 5551

[求助]如何历遍电脑上的磁盘?

2006-12-18 03:36
5551
如题,貌似就用这个循环

_test proc
.repeat
mov eax,"C:"
inc eax
;这里处理
.until (eax > "J")||(eax == FALSE)
_test endp

不知道对不对

[课程]Android-CTF解题方法汇总!

收藏
免费 1
支持
分享
最新回复 (8)
雪    币: 297
活跃值: (10)
能力值: ( LV9,RANK:250 )
在线值:
发帖
回帖
粉丝
2
这个是枚举出系统中所有输入设备的代码,包括键盘,鼠标等。

#include <stdio.h>
#include <windows.h>

//////////////////////////////////////////////////////////////////////////

typedef struct tagRAWINPUTDEVICELIST {
HANDLE hDevice;
DWORD dwType;
} RAWINPUTDEVICELIST, *PRAWINPUTDEVICELIST;

#define RIM_TYPEKEYBOARD 1

typedef UINT (_stdcall * PGetRawInputDeviceList)(PRAWINPUTDEVICELIST, PUINT, UINT);

//////////////////////////////////////////////////////////////////////////

typedef struct tagRAWINPUTDEVICE {
USHORT usUsagePage;
USHORT usUsage;
DWORD dwFlags;
HWND hwndTarget;
} RAWINPUTDEVICE, *PRAWINPUTDEVICE, *LPRAWINPUTDEVICE;

typedef BOOL (_stdcall * PRegisterRawInputDevices)(PRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize);
//////////////////////////////////////////////////////////////////////////

typedef struct tagRAWINPUTHEADER {
DWORD dwType;
DWORD dwSize;
HANDLE hDevice;
WPARAM wParam;
} RAWINPUTHEADER, *PRAWINPUTHEADER;

typedef struct tagRAWMOUSE {
USHORT usFlags;
union {
ULONG ulButtons;
struct {
USHORT usButtonFlags;
USHORT usButtonData;
};
};
ULONG ulRawButtons;
LONG lLastX;
LONG lLastY;
ULONG ulExtraInformation;
} RAWMOUSE, *PRAWMOUSE, *LPRAWMOUSE;

typedef struct tagRAWKEYBOARD {
USHORT MakeCode;
USHORT Flags;
USHORT Reserved;
USHORT VKey;
UINT Message;
ULONG ExtraInformation;
} RAWKEYBOARD, *PRAWKEYBOARD, *LPRAWKEYBOARD;

typedef struct tagRAWHID {
DWORD dwSizeHid;
DWORD dwCount;
BYTE bRawData;
} RAWHID, **LPRAWHID;

typedef struct tagRAWINPUT {
RAWINPUTHEADER header;
union {
RAWMOUSE mouse;
RAWKEYBOARD keyboard;
RAWHID hid;
} data;
} RAWINPUT, *PRAWINPUT, *LPRAWINPUT;

//////////////////////////////////////////////////////////////////////////

void RegistInputDevice()
{
PRegisterRawInputDevices RegisterRawInputDevices = NULL;
RegisterRawInputDevices = (PRegisterRawInputDevices)GetProcAddress(LoadLibrary("User32.dll"), "RegisterRawInputDevices");
if(NULL == RegisterRawInputDevices)
{
printf("Get RegisterRawInputDevices error..\n");
return;
}
RAWINPUTDEVICE rid;
rid.usUsage = 6;
rid.usUsagePage = 1;
rid.hwndTarget = NULL;
if(RegisterRawInputDevices(&rid, 1, sizeof(RAWINPUTDEVICE)))
{
printf("regesit Ok!\n");
return;
}
}


int main(void)
{
HANDLE hHeap = GetProcessHeap();
UINT nDevices = 0;
PGetRawInputDeviceList GetRawInputDeviceList = NULL;

HMODULE hUser32 = LoadLibrary("User32.dll");
if(hUser32 != NULL)
{
GetRawInputDeviceList = (PGetRawInputDeviceList)GetProcAddress(hUser32, "GetRawInputDeviceList");
if(NULL == GetRawInputDeviceList)
{
printf("Load GetRawInputDeviceList error..\n");
FreeLibrary(hUser32);
return -1;
}
}
else
{
printf("Load user32.dll error..\n");
return -1;
}


GetRawInputDeviceList(NULL, &nDevices, sizeof(RAWINPUTDEVICELIST));
PRAWINPUTDEVICELIST pril = (PRAWINPUTDEVICELIST)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, sizeof(RAWINPUTDEVICELIST) * nDevices);
PRAWINPUT pri = (PRAWINPUT)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, 1024);

if(NULL == pril)
{
printf("HeapAlloc error..\n");
FreeLibrary(hUser32);
return -1;
}

nDevices = GetRawInputDeviceList(pril, &nDevices, sizeof(RAWINPUTDEVICELIST));
if(nDevices <= 0)
{
printf("GetRawInputDeviceList error..\n");
HeapFree(hHeap, HEAP_ZERO_MEMORY, pril);
FreeLibrary(hUser32);
return -1;
}

printf("All %d input devices:\n", nDevices);
for(UINT i = 0; i < nDevices; i++)
{
printf("hDevice: %08x\ttype: %08x\n", pril->hDevice, pril->dwType);
pril++;
}

HeapFree(hHeap, HEAP_ZERO_MEMORY, pril);
FreeLibrary(hUser32);
return 0;

}
2006-12-18 12:35
0
雪    币: 796
活跃值: (370)
能力值: ( LV9,RANK:380 )
在线值:
发帖
回帖
粉丝
3
啃一下你发的代码,谢谢拉 
2006-12-18 20:08
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
GetLogicalDriveStrings

The GetLogicalDriveStrings function fills a buffer with strings that specify valid drives in the system.

DWORD GetLogicalDriveStrings(
  DWORD nBufferLength,
  LPTSTR lpBuffer
);

Parameters
nBufferLength
[in] Maximum size of the buffer pointed to by lpBuffer, in TCHARs. This size does not include the terminating null character. If this parameter is zero, lpBuffer is not used.
lpBuffer
[out] Pointer to a buffer that receives a series of null-terminated strings, one for each valid drive in the system, that end with a second null character. The following example shows the buffer contents with <null> representing the terminating null character.
c:\<null>d:\<null><null>
Return Values
If the function succeeds, the return value is the length, in characters, of the strings copied to the buffer, not including the terminating null character. Note that an ANSI-ASCII null character uses one byte, but a Unicode null character uses two bytes.

If the buffer is not large enough, the return value is greater than nBufferLength. It is the size of the buffer required to hold the drive strings.

If the function fails, the return value is zero. To get extended error information, use the GetLastError function.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

GetLogicalDrives

The GetLogicalDrives function retrieves a bitmask representing the currently available disk drives.

DWORD GetLogicalDrives(void);

Parameters
This function has no parameters.
Return Values
If the function succeeds, the return value is a bitmask representing the currently available disk drives. Bit position 0 (the least-significant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C, and so on.

If the function fails, the return value is zero. To get extended error information, call GetLastError.
2006-12-18 21:26
0
雪    币: 297
活跃值: (10)
能力值: ( LV9,RANK:250 )
在线值:
发帖
回帖
粉丝
5
sorry,看错LZ的意思了。
这个代码是枚举系统的所有输入设备的。
枚举硬盘,我帮你看看。。。
你可以看看与SetupDiCreateDeviceInfo相关的API
2006-12-18 21:40
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
MASM32中的例子里有源代码
2007-2-5 01:47
0
雪    币: 796
活跃值: (370)
能力值: ( LV9,RANK:380 )
在线值:
发帖
回帖
粉丝
7
Originally posted by ninja
MASM32中的例子里有源代码


在哪个目录?

masm32v8.0一共有9个例子代码目录
2007-2-5 10:26
0
雪    币: 218
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
KmdKit v1.8下好象有一个masm32源代码
2007-2-6 22:13
0
雪    币: 383
活跃值: (41)
能力值: ( LV12,RANK:530 )
在线值:
发帖
回帖
粉丝
9
用一个循环,用GetDrivetypeType判断
2007-2-9 20:18
0
游客
登录 | 注册 方可回帖
返回
//