Вопрос Get GPU name через ffi

Начинающий
Статус
Оффлайн
Регистрация
8 Июн 2021
Сообщения
7
Реакции[?]
1
Поинты[?]
0
Вопрос сверху (Если можно, то и гет названия процессора через ffi )
 
Последнее редактирование:
Пользователь
Статус
Оффлайн
Регистрация
6 Дек 2021
Сообщения
190
Реакции[?]
33
Поинты[?]
0
Вопрос сверху (Если можно, то и гет процессора через ffi )

Код:
local MaterialAdapterInfo_t = ffi.typeof([[
    struct {
        char m_pDriverName[512];
        unsigned int m_VendorID;
        unsigned int m_DeviceID;
        unsigned int m_SubSysID;
        unsigned int m_Revision;
        int m_nDXSupportLevel;
        int m_nMinDXSupportLevel;
        int m_nMaxDXSupportLevel;
        unsigned int m_nDriverVersionHigh;
        unsigned int m_nDriverVersionLow;
    }                                                                                               
]])

local get_current_adapter = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 25, 'int(__thiscall*)(void*)')
local get_adapter_info = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 26, 'void(__thiscall*)(void*, int, void*)')

local current_adapter = get_current_adapter()

local adapter_struct = ffi.new(MaterialAdapterInfo_t)

get_adapter_info(current_adapter, adapter_struct)

local vendorId = tostring(adapter_struct['m_VendorID'])
local deviceId = tostring(adapter_struct['m_DeviceID'])
 
Начинающий
Статус
Оффлайн
Регистрация
8 Июн 2021
Сообщения
7
Реакции[?]
1
Поинты[?]
0
Код:
local MaterialAdapterInfo_t = ffi.typeof([[
    struct {
        char m_pDriverName[512];
        unsigned int m_VendorID;
        unsigned int m_DeviceID;
        unsigned int m_SubSysID;
        unsigned int m_Revision;
        int m_nDXSupportLevel;
        int m_nMinDXSupportLevel;
        int m_nMaxDXSupportLevel;
        unsigned int m_nDriverVersionHigh;
        unsigned int m_nDriverVersionLow;
    }                                                                                          
]])

local get_current_adapter = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 25, 'int(__thiscall*)(void*)')
local get_adapter_info = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 26, 'void(__thiscall*)(void*, int, void*)')

local current_adapter = get_current_adapter()

local adapter_struct = ffi.new(MaterialAdapterInfo_t)

get_adapter_info(current_adapter, adapter_struct)

local vendorId = tostring(adapter_struct['m_VendorID'])
local deviceId = tostring(adapter_struct['m_DeviceID'])
Можно пример использования
UPDATE:
Lua error: C:\Users\ALFA\AppData\Roaming\Legendware\Scripts\--test.lua:17: attempt to call global 'vtable_bind' (a nil value)
 
Последнее редактирование:
Пользователь
Статус
Оффлайн
Регистрация
6 Дек 2021
Сообщения
190
Реакции[?]
33
Поинты[?]
0
Можно пример использования

Можно пример использования (не шарю просто)
Код:
local ffi = require 'ffi'
local hwid_lock = {
    "3369050214" -- ME
}

local MaterialAdapterInfo_t = ffi.typeof([[
    struct {
        char m_pDriverName[512];
        unsigned int m_VendorID;
        unsigned int m_DeviceID;
        unsigned int m_SubSysID;
        unsigned int m_Revision;
        int m_nDXSupportLevel;
        int m_nMinDXSupportLevel;
        int m_nMaxDXSupportLevel;
        unsigned int m_nDriverVersionHigh;
        unsigned int m_nDriverVersionLow;
    }                                                                                               
]])

local get_current_adapter = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 25, 'int(__thiscall*)(void*)')
local get_adapter_info = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 26, 'void(__thiscall*)(void*, int, void*)')

local current_adapter = get_current_adapter()

local adapter_struct = ffi.new(MaterialAdapterInfo_t)

get_adapter_info(current_adapter, adapter_struct)

local vendorId = tostring(adapter_struct['m_VendorID'])
local deviceId = tostring(adapter_struct['m_DeviceID'])

local you = vendorId..deviceId

local gayporno = string.format("%x", you * 255)

local access = false

for you, value in pairs(hwid_lock) do
    if value == gayporno then
        access = true
    end
end

if access then
    do_smth()
else
    close_with_error()
end
не пробовал, но должно работать
 
Начинающий
Статус
Оффлайн
Регистрация
8 Июн 2021
Сообщения
7
Реакции[?]
1
Поинты[?]
0
Код:
local ffi = require 'ffi'
local hwid_lock = {
    "3369050214" -- ME
}

local MaterialAdapterInfo_t = ffi.typeof([[
    struct {
        char m_pDriverName[512];
        unsigned int m_VendorID;
        unsigned int m_DeviceID;
        unsigned int m_SubSysID;
        unsigned int m_Revision;
        int m_nDXSupportLevel;
        int m_nMinDXSupportLevel;
        int m_nMaxDXSupportLevel;
        unsigned int m_nDriverVersionHigh;
        unsigned int m_nDriverVersionLow;
    }                                                                                              
]])

local get_current_adapter = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 25, 'int(__thiscall*)(void*)')
local get_adapter_info = vtable_bind('materialsystem.dll', 'VMaterialSystem080', 26, 'void(__thiscall*)(void*, int, void*)')

local current_adapter = get_current_adapter()

local adapter_struct = ffi.new(MaterialAdapterInfo_t)

get_adapter_info(current_adapter, adapter_struct)

local vendorId = tostring(adapter_struct['m_VendorID'])
local deviceId = tostring(adapter_struct['m_DeviceID'])

local you = vendorId..deviceId

local gayporno = string.format("%x", you * 255)

local access = false

for you, value in pairs(hwid_lock) do
    if value == gayporno then
        access = true
    end
end

if access then
    do_smth()
else
    close_with_error()
end
не пробовал, но должно работать
не работает
 
Начинающий
Статус
Оффлайн
Регистрация
24 Ноя 2020
Сообщения
13
Реакции[?]
1
Поинты[?]
0
really aint that hard
code_language.lua:
local vtable = {}


local __thiscall = function(func, this)
    return function(...) return func(this, ...) end
end


local interface_ptr = ffi.typeof("void***")

vtable.bind = function(module, interface, index, typedef)
    local addr = ffi.cast("void***", utils.create_interface(module, interface)) or error(interface .. " was not found")
    return __thiscall(ffi.cast(typedef, addr[0][index]), addr)
end


vtable.entry = function(instance, i, ct)
    return ffi.cast(ct, ffi.cast(interface_ptr, instance)[0][i])
end

local MaterialAdapterInfo_t = ffi.typeof([[
    struct {
        char m_pDriverName[512];
        unsigned int m_VendorID;
        unsigned int m_DeviceID;
        unsigned int m_SubSysID;
        unsigned int m_Revision;
        int m_nDXSupportLevel;
        int m_nMinDXSupportLevel;
        int m_nMaxDXSupportLevel;
        unsigned int m_nDriverVersionHigh;
        unsigned int m_nDriverVersionLow;
    }                                                                                               
]])

local get_current_adapter = vtable.bind('materialsystem.dll', 'VMaterialSystem080', 25, 'int(__thiscall*)(void*)')
local get_adapter_info = vtable.bind('materialsystem.dll', 'VMaterialSystem080', 26, 'void(__thiscall*)(void*, int, void*)')

local current_adapter = get_current_adapter()
local adapter_struct = ffi.new(MaterialAdapterInfo_t)

get_adapter_info(current_adapter, adapter_struct)

local driverName = tostring(ffi.string(adapter_struct['m_pDriverName']))
 
Начинающий
Статус
Оффлайн
Регистрация
8 Июн 2021
Сообщения
7
Реакции[?]
1
Поинты[?]
0
really aint that hard
code_language.lua:
local vtable = {}


local __thiscall = function(func, this)
    return function(...) return func(this, ...) end
end


local interface_ptr = ffi.typeof("void***")

vtable.bind = function(module, interface, index, typedef)
    local addr = ffi.cast("void***", utils.create_interface(module, interface)) or error(interface .. " was not found")
    return __thiscall(ffi.cast(typedef, addr[0][index]), addr)
end


vtable.entry = function(instance, i, ct)
    return ffi.cast(ct, ffi.cast(interface_ptr, instance)[0][i])
end

local MaterialAdapterInfo_t = ffi.typeof([[
    struct {
        char m_pDriverName[512];
        unsigned int m_VendorID;
        unsigned int m_DeviceID;
        unsigned int m_SubSysID;
        unsigned int m_Revision;
        int m_nDXSupportLevel;
        int m_nMinDXSupportLevel;
        int m_nMaxDXSupportLevel;
        unsigned int m_nDriverVersionHigh;
        unsigned int m_nDriverVersionLow;
    }                                                                                              
]])

local get_current_adapter = vtable.bind('materialsystem.dll', 'VMaterialSystem080', 25, 'int(__thiscall*)(void*)')
local get_adapter_info = vtable.bind('materialsystem.dll', 'VMaterialSystem080', 26, 'void(__thiscall*)(void*, int, void*)')

local current_adapter = get_current_adapter()
local adapter_struct = ffi.new(MaterialAdapterInfo_t)

get_adapter_info(current_adapter, adapter_struct)

local driverName = tostring(ffi.string(adapter_struct['m_pDriverName']))
ty
 
Сверху Снизу