1
0
mirror of synced 2024-11-27 23:10:49 +01:00
bananatools/amcus/iauth.h
2023-02-12 03:12:22 -05:00

360 lines
9.8 KiB
C

#pragma once
#include <windows.h>
#include <combaseapi.h>
#include <rpcproxy.h>
#include <stdint.h>
#include "amcus/config.h"
void iauth_set_config(struct amcus_config *cfg);
enum daemon_state {
DAEMON_UNKNOWN,
DAEMON_GET_HOP,
DAEMON_GET_TIP,
DAEMON_GET_AIP,
DAEMON_GET_NET_INFO,
DAEMON_INIT,
DAEMON_AUTH_START,
DAEMON_AUTH_BUSY,
DAEMON_AUTH_RETRY,
DAEMON_DL,
DAEMON_EXPORT,
DAEMON_IMPORT,
DAEMON_CONSUME_CHARGE,
DAEMON_NOTIFY_CHARGE,
DAEMON_CHECK_LAN,
DAEMON_IDLE,
DAEMON_FINALIZE,
DAEMON_BUSY
};
enum daemon_error {
ERR_CHARGE_COMM = -14,
ERR_DL_TIMEOUT = -11,
ERR_SYSTEM,
ERR_NO_INIT,
ERR_NO_AUTH,
ERR_AUTH_COMM,
ERR_AUTH_TIMEOUT,
ERR_AUTH,
ERR_INIT,
ERR_CFG,
ERR_NETWORK,
ERR_UNKNOWN,
ERR_NONE
};
enum line_type {
TYPE_UNKNOWN,
TYPE_FFT,
TYPE_DSL,
TYPE_ETC,
TYPE_MOBILE
};
enum link_state {
STATE_UNKNOWN,
STATE_OK,
STATE_NG,
STATE_CHECK
};
enum updater_state {
UPDATE_STATE_UNKNOWN,
UPDATE_NOT_NECESSASSARY,
UPDATE_NOT_YET_PERM_DATA,
UPDATE_NOT_YET_PERM,
UPDATE_NOT_YET_DATA,
UPDATE_STATE_UNAVAILABLE
};
enum auth_type {
AUTH_TYPE_OFFLINE,
AUTH_TYPE_ALLNET,
AUTH_TYPE_NBLINE,
AUTH_TYPE_CHARGE_NORMAL,
AUTH_TYPE_CHARGE_MONTHLY
};
enum daemon_mode {
DAEMON_MODE_UNKNOWN,
DAEMON_MODE_SERVER,
DAEMON_MODE_CLIENT,
DAEMON_MODE_STANDALONE,
};
enum amdaemon_info {
AMDAEMON_UNINITIALIZED,
AMDAEMON_AUTH_UNKNOWN,
AMDAEMON_AUTH_OK,
AMDAEMON_AUTH_NG,
AMDAEMON_AUTH_NG_REGIST,
AMDAEMON_AUTH_NG_BOARD,
AMDAEMON_AUTH_NG_PLACE,
AMDAEMON_AUTH_NG_RESPONSE,
AMDAEMON_AUTH_NG_OTHER
};
enum dlexec_state {
DLEXEC_UNKNOWN = 25,
DLEXEC_NONE,
DLEXEC_PROC,
DLEXEC_STOP,
DLEXEC_STOPPING,
};
enum dlstep_state {
DLSTEP_UNKNOWN = 30,
DLSTEP_NONE,
DLSTEP_IDLE,
DLSTEP_PARTIMG_CHECK,
DLSTEP_STOP_REQ,
DLSTEP_LAN_VERINFO,
DLSTEP_LAN_CHECKCODE,
DLSTEP_LAN_IMGCHUNK,
DLSTEP_WAN_CHECKCODE,
DLSTEP_WAN_IMGCHUNK,
};
enum dllan_state {
DLLAN_UNKNOWN = 40,
DLLAN_NONE,
DLLAN_REQ,
DLLAN_DISABLE,
DLLAN_SERVER_NOTHING,
DLLAN_SERVER_VER_NOTHING,
DLLAN_SERVER_CHECKCODE_NOTHING,
DLLAN_SERVER_IMGCHUNK_NOTHING,
DLLAN_COMPLETE
};
enum dlwan_state {
DLWAN_UNKNOWN = 49,
DLWAN_NONE,
DLWAN_REQ,
DLWAN_COMPLETE,
DLWAN_DISABLE,
DLWAN_WANENV_INVALID,
DLWAN_BASICAUTHKEY_INVALID,
DLWAN_SERVER_VERINFO_NOTHING,
DLWAN_SERVER_VERINFO_VERSION_NOTHING,
};
enum daemon_io_info {
DAEMON_IO_UNKNOWN = 58,
DAEMON_IO_NONE,
DAEMON_IO_IDLE,
DAEMON_IO_EXPORT,
DAEMON_IO_IMPORT,
DAEMON_IO_FAIL,
DAEMON_IO_SUCCESS,
};
// member names are wrong lol
/* Memory Size: 20 */
struct allnet_state {
/* Offset: 0 */ /* ENUM32 */ uint32_t state;
/* Offset: 4 */ /* ENUM32 */ uint32_t error;
/* Offset: 8 */ int32_t auth_state;
/* Offset: 12 */ int32_t auth_count;
/* Offset: 16 */ int32_t last_error;
};
/* Memory Size: 144 */
struct mucha_state {
/* Offset: 0 */ /* ENUM32 */ uint32_t state;
/* Offset: 4 */ /* ENUM32 */ uint32_t error;
/* Offset: 8 */ int32_t auth_state;
/* Offset: 12 */ int32_t auth_count;
/* Offset: 16 */ int32_t state_dlexec;
/* Offset: 20 */ int32_t state_dlstep;
/* Offset: 24 */ int32_t state_dllan;
/* Offset: 28 */ int32_t state_dlwan;
/* Offset: 32 */ int32_t state_io;
/* Offset: 36 */ int16_t cacfg_ver_major;
/* Offset: 38 */ int16_t cacfg_ver_minor;
/* Offset: 40 */ int16_t app_ver_major;
/* Offset: 42 */ int16_t app_ver_minor;
/* Offset: 44 */ int16_t dl_ver_major;
/* Offset: 46 */ int16_t dl_ver_minor;
/* Offset: 48 */ int32_t dl_ver_total;
/* Offset: 52 */ int32_t dl_ver_done;
/* Offset: 56 */ int64_t dl_total;
/* Offset: 64 */ int64_t dl_done;
/* Offset: 72 */ int64_t dl_pc_done;
/* Offset: 80 */ int64_t dl_io_total;
/* Offset: 88 */ int64_t dl_io_done;
/* Offset: 96 */ int32_t dl_check_complete;
/* Offset: 100 */ int32_t token_consumed;
/* Offset: 104 */ int32_t token_charged;
/* Offset: 108 */ int32_t token_unit;
/* Offset: 112 */ int32_t token_lower;
/* Offset: 116 */ int32_t token_upper;
/* Offset: 120 */ int32_t token_added;
/* Offset: 124 */ int32_t token_month_lower;
/* Offset: 128 */ int32_t token_month_upper;
/* Offset: 132 */ int32_t is_forced_boot;
/* Offset: 136 */ int32_t Member88;
};
/* Memory Size: 200 */
struct amcus_state {
/* Offset: 0 */ struct allnet_state allnet_state;
/* Offset: 24 */ struct mucha_state mucha_state;
/* Offset: 168 */ int64_t clock_status;
/* Offset: 176 */ int64_t name_resolution_timeout;
/* Offset: 184 */ /* ENUM32 */ uint32_t auth_type;
/* Offset: 188 */ /* ENUM32 */ uint32_t cab_mode;
/* Offset: 192 */ /* ENUM32 */ uint32_t state;
/* Offset: 196 */ /* ENUM32 */ uint32_t err;
};
/* Memory Size: 316 */
struct amcus_version_info {
char game_rev[4];
char auth_type[16];
char game_id[8];
char game_ver[8];
char game_cd[8];
char cacfg_game_ver[8];
char game_board_type[4];
char game_board_id[4];
char auth_url[256];
};
/* Memory Size: 168 */
struct amcus_network_state {
char mode[16];
char pcbid[16];
char dongle_serial[16];
char shop_router_ip[16];
char auth_server_ip[16];
char local_ip[16];
char subnet_mask[16];
char gateway[16];
char primary_dns[16];
int hop_count;
uint32_t line_type;
uint32_t line_status;
uint32_t content_router_status;
uint32_t shop_router_status;
uint32_t hop_status;
};
/* Memory Size: 3808 */
struct mucha_boardauth_resp {
/* Offset: 0 */ char url_charge[256];
/* Offset: 256 */ char url_file[256];
/* Offset: 512 */ char url_url1[256];
/* Offset: 768 */ char url_url2[256];
/* Offset: 1024 */ char url_url3[256];
/* Offset: 1280 */ char place_id[16];
/* Offset: 1296 */ char country_cd[16];
/* Offset: 1312 */ char shop_name[256];
/* Offset: 1568 */ char shop_nickname[128];
/* Offset: 1696 */ char area0[64];
/* Offset: 1760 */ char area1[64];
/* Offset: 1824 */ char area2[64];
/* Offset: 1888 */ char area3[64];
/* Offset: 1952 */ char area_full0[256];
/* Offset: 2208 */ char area_full1[256];
/* Offset: 2464 */ char area_full2[256];
/* Offset: 2720 */ char area_full3[256];
/* Offset: 2976 */ char shop_name_en[64];
/* Offset: 3040 */ char shop_nickname_en[32];
/* Offset: 3072 */ char area0_en[32];
/* Offset: 3104 */ char area1_en[32];
/* Offset: 3136 */ char area2_en[32];
/* Offset: 3168 */ char area3_en[32];
/* Offset: 3200 */ char area_full0_en[128];
/* Offset: 3328 */ char area_full1_en[128];
/* Offset: 3456 */ char area_full2_en[128];
/* Offset: 3584 */ char area_full3_en[128];
/* Offset: 3712 */ char prefecture_id[16];
/* Offset: 3728 */ char expiration_date[16];
/* Offset: 3744 */ char use_token[16];
/* Offset: 3760 */ char consume_token[32];
/* Offset: 3792 */ char dongle_flag[8];
/* Offset: 3800 */ char force_boot[8];
};
/* Memory Size: 56 */
struct mucha_updater_state {
/* Offset: 0 */ /* ENUM32 */ uint64_t state;
/* Offset: 8 */ int64_t enforce_done;
/* Offset: 16 */ int64_t enforce_total;
/* Offset: 24 */ int64_t distrib_done;
/* Offset: 32 */ int64_t distrib_total;
/* Offset: 40 */ int64_t exec_total;
/* Offset: 48 */ int16_t dl_ver_major;
/* Offset: 50 */ int16_t dl_ver_minor;
/* Offset: 52 */ int16_t Member34;
/* Offset: 54 */ int16_t Member36;
};
/* Memory Size: 2210 */
struct amcus_auth_server_resp {
char uri[257];
char host[257];
char shop_name[256];
char shop_nickname[256];
char region0[16];
char region_name0[256];
char region_name1[256];
char region_name2[256];
char region_name3[256];
char place_id[16];
char setting[16];
char country[16];
char timezone[32];
char res_class[64];
};
#undef INTERFACE
#define INTERFACE IAuth
DECLARE_INTERFACE_(IAuth,CStdStubBuffer)
{
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
STDMETHOD_(HRESULT,Initialize)(THIS_ int64_t p0) PURE;
STDMETHOD_(HRESULT,Finalize)(THIS) PURE;
STDMETHOD_(HRESULT,Func5)(THIS_ int64_t p0) PURE;
STDMETHOD_(LONG,Func6)() PURE;
STDMETHOD_(HRESULT,Func7)() PURE;
STDMETHOD_(HRESULT,Func8)() PURE;
STDMETHOD_(HRESULT,GetUpdaterState)(THIS_ struct amcus_state *arr) PURE;
STDMETHOD_(HRESULT,GetCabinetConfig)(THIS_ struct amcus_network_state *arr) PURE;
STDMETHOD_(HRESULT,GetVersionInfo)(THIS_ struct amcus_version_info *arr) PURE;
STDMETHOD_(HRESULT,Func12)() PURE;
STDMETHOD_(HRESULT,Func13)() PURE;
STDMETHOD_(HRESULT,GetAuthServerResp)(THIS_ struct amcus_auth_server_resp *arr) PURE;
STDMETHOD_(HRESULT,Func15)() PURE;
STDMETHOD_(HRESULT,Func16)() PURE;
STDMETHOD_(HRESULT,Func17)() PURE;
STDMETHOD_(HRESULT,GetMuchaAuthResponse)(THIS_ struct mucha_boardauth_resp *arr) PURE;
STDMETHOD_(HRESULT,Func19)(THIS_ struct mucha_updater_state *arr) PURE;
STDMETHOD_(HRESULT,Func20)() PURE;
STDMETHOD_(HRESULT,Func21)() PURE;
STDMETHOD_(HRESULT,Func22)() PURE;
STDMETHOD_(HRESULT,Func23)(THIS_ int64_t p0) PURE;
STDMETHOD_(HRESULT,Func24)() PURE;
STDMETHOD_(HRESULT,Func25)() PURE;
STDMETHOD_(HRESULT,Func26)() PURE;
STDMETHOD_(HRESULT,Func27)() PURE;
STDMETHOD_(HRESULT,Func28)() PURE;
STDMETHOD_(HRESULT,Func29)() PURE;
STDMETHOD_(HRESULT,Func30)() PURE;
STDMETHOD_(HRESULT,Func31)() PURE;
STDMETHOD_(HRESULT,Func32)(THIS_ int64_t p0, int64_t* p1) PURE;
STDMETHOD_(HRESULT,Func33)(THIS_ int64_t p0, int64_t* p1, int64_t* p2, int64_t* p3, int64_t* p4) PURE;
};
#undef INTERFACE
extern IAuth *iauth_stub;