Skip to content

Commit

Permalink
update cdi
Browse files Browse the repository at this point in the history
  • Loading branch information
a1ive committed Jul 10, 2023
1 parent 7971482 commit d9ddaa8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
28 changes: 17 additions & 11 deletions AtaSmart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12583,23 +12583,29 @@ A_AMD_RC2_GetSmartData AMD_RC2_GetSmartData = NULL;

BOOL AMD_RC2_DLL_Load() {

wchar_t buffer1[261] = {}, dir1[261] = {}, buffer3[261] = {};
DebugPrint(L"AMD_RC2_DLL_Load");

GetModuleFileNameW(NULL, buffer1, 261);
_wsplitpath_s(buffer1, dir1, 261, buffer3, 261, NULL, 0, NULL, 0);
wcscat_s(dir1, 261, buffer3);
TCHAR fullPath[MAX_PATH] = {};
TCHAR drive[MAX_PATH] = {};
TCHAR path[MAX_PATH] = {};
TCHAR dllPath[MAX_PATH] = {};

GetModuleFileNameW(NULL, fullPath, MAX_PATH);
_wsplitpath_s(fullPath, drive, MAX_PATH, path, MAX_PATH, NULL, 0, NULL, 0);
wcscat_s(dllPath, MAX_PATH, drive);
wcscat_s(dllPath, MAX_PATH, path);
wcscat_s(dllPath, MAX_PATH, DLL_DIR);

wcscpy_s(buffer1, 261, dir1);
#ifdef _M_AMD64
wcscat_s(buffer1, 261, L"AMD_RC2t7x64.dll");
wcscat_s(dllPath, MAX_PATH, L"AMD_RC2t7x64.dll");
#else
wcscat_s(buffer1, 261, L"AMD_RC2t7x86.dll");
wcscat_s(dllPath, MAX_PATH, L"AMD_RC2t7x86.dll");
#endif

// check sign

WINTRUST_FILE_INFO FileData = { sizeof(WINTRUST_FILE_INFO) };
FileData.pcwszFilePath = buffer1;
FileData.pcwszFilePath = dllPath;

GUID WVTPolicyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2;
WINTRUST_DATA WinTrustData = { sizeof(WinTrustData) };
Expand Down Expand Up @@ -12639,7 +12645,7 @@ BOOL AMD_RC2_DLL_Load() {

// DLL load

g_AMD_RC2_hmodule = LoadLibraryW(buffer1);
g_AMD_RC2_hmodule = LoadLibraryW(dllPath);
if (!g_AMD_RC2_hmodule) return FALSE;

// get functions
Expand All @@ -12660,7 +12666,7 @@ BOOL AMD_RC2_DLL_Load() {

// check status

g_AMD_RC2_load = ( status == AMD_RC2_ERROR_CODE::AMD_RC2_loaded );
g_AMD_RC2_load = (status == AMD_RC2_ERROR_CODE::AMD_RC2_loaded);
if (!g_AMD_RC2_load) {
if (status > AMD_RC2_ERROR_CODE::AMD_RC2_MAX) status = AMD_RC2_ERROR_CODE::AMD_RC2_MAX;

Expand All @@ -12679,13 +12685,13 @@ BOOL AMD_RC2_DLL_Load() {
_T("AMD_RC2_unknown")
};
DebugPrint(error_msg[status]);

}
g_AMD_RC2_init = TRUE;
return g_AMD_RC2_load;
}
#endif


BOOL CAtaSmart::AddDiskAMD_RC2()
{
int count = 0;
Expand Down
2 changes: 1 addition & 1 deletion AtaSmart.h
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ struct MEGARAID_PHYSICAL_DRIVE_LIST
BOOL FlagMegaRAID = FALSE;
BOOL FlagIntelVROC = FALSE;
BOOL FlagUsbASM1352R = FALSE;
BOOL FlagAMD_RC2 = TRUE;// +AMD_RC2
BOOL FlagAMD_RC2 = FALSE;// +AMD_RC2
#ifdef JMICRON_USB_RAID_SUPPORT
BOOL FlagUsbJMS56X = FALSE;
BOOL FlagUsbJMB39X = FALSE;
Expand Down

0 comments on commit d9ddaa8

Please sign in to comment.