解决读取内存和硬盘异常的问题
This commit is contained in:
parent
cb6b0da109
commit
4769cd1b04
|
@ -40,7 +40,7 @@ win32 {
|
|||
}
|
||||
|
||||
LIBS += -L$$PWD/../../../code_app/build2/build/$${MY_OS}/$${OEM_NAME}/$${MY_ARCH}/$${MY_CONFIGURE} -l$${OEM_PREFIX}Base -l$${OEM_PREFIX}ImgFmt -l$${OEM_PREFIX}ImgProc
|
||||
LIBS += -L$$PWD/../../../sdk/lib/win/$${MY_ARCH}/OEM/$${OEM_NAME} -lsane
|
||||
LIBS += -L$$PWD/../../../sdk/lib/win/$${MY_ARCH}/OEM/$${OEM_NAME} -lsanexy
|
||||
|
||||
# sane.dll
|
||||
LIBS += -L$$PWD/../../../release/win/$${MY_ARCH}/OEM/$${OEM_NAME}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include"test_base.h"
|
||||
#include"test_base.h"
|
||||
#include<string>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
@ -1482,25 +1482,26 @@ public:
|
|||
std::string cpu;
|
||||
unsigned len = 0;
|
||||
std::wstring wstr;
|
||||
size_t l = 0;
|
||||
size_t size = 0;
|
||||
int ret = helper_->io_control(IO_CTRL_CODE_GET_DEVS_CPU, &cpu[0], &len);
|
||||
ret = str_to_wchar(cpu.c_str(), (wchar_t*)wstr.c_str(), &l);
|
||||
ret = str_to_wchar(cpu.c_str(), (wchar_t*)wstr.c_str(), &size);
|
||||
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
wstr.resize(l);
|
||||
ret = str_to_wchar(cpu.c_str(), (wchar_t*)wstr.c_str(), &l);
|
||||
wstr.resize(size);
|
||||
ret = str_to_wchar(cpu.c_str(), (wchar_t*)wstr.c_str(), &size);
|
||||
}
|
||||
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_CPU, (void*)wstr.c_str(), true);
|
||||
|
||||
std::string disk;
|
||||
unsigned len2 = 0;
|
||||
std::wstring wstr2;
|
||||
size_t size2 = 0;
|
||||
ret = helper_->io_control(IO_CTRL_CODE_GET_DEVS_DISK, &disk[0], &len2);
|
||||
ret = str_to_wchar(disk.c_str(), (wchar_t*)wstr2.c_str(), &l);
|
||||
ret = str_to_wchar(disk.c_str(), (wchar_t*)wstr2.c_str(), &size2);
|
||||
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
wstr2.resize(l);
|
||||
ret = str_to_wchar(disk.c_str(), (wchar_t*)wstr2.c_str(), &l);
|
||||
wstr2.resize(size2);
|
||||
ret = str_to_wchar(disk.c_str(), (wchar_t*)wstr2.c_str(), &size2);
|
||||
}
|
||||
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVEB_GET_DEVICE_DEVS_CPU, (void*)wstr2.c_str(), true);
|
||||
|
||||
|
@ -1511,7 +1512,6 @@ public:
|
|||
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)(L"获取失败"), false);
|
||||
return -1;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)(L"获取完成"), true);
|
||||
|
|
Loading…
Reference in New Issue