Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions FFXIVClientStructs/FFXIV/Client/SupportDesk/HttpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ public unsafe partial struct HttpConnection {
[VirtualFunction(0)]
public partial HttpRequest* Dtor(byte freeFlags);

// Initializes the HTTP session.
/// <summary> Initializes the HTTP session. </summary>
[VirtualFunction(1)]
public partial void OpenSession();

// Cleans up the HTTP session.
/// <summary> Cleans up the HTTP session. </summary>
[VirtualFunction(2)]
public partial void CloseSession();

/// <summary> Creates a new HTTPRequest. </summary>
/// <param name="url">URL to make a request to.</param>
/// <param name="verb">The HTTP verb, such as "GET" or "POST".</param>
/// <param name="data">Any request data to send (only relevant for POST requests really).</param>
/// <param name="dataLength">Length of the data buffer.</param>
/// <returns>The new HTTPRequest handle if it could be successfully created.</returns>
[VirtualFunction(4)]
public partial HttpRequest* MakeRequest(byte* url, byte* verb, byte* data, ulong dataLength);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little unsure about this API, because I'm not really sure what kind of string it is. On the plugin side, I can do Marshal.PtrToStringAnsi on this and get a valid string, so is it a CStringPointer? And then data is technically always a valid string too as far as I've seen, maybe I should do the same there?

@Haselnussbomber Haselnussbomber Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url and verb should be CStringPointer, yeah. Make sure to add [GenerateStringOverloads].
Personally, I think the data parameter should stay byte* as it has an extra dataLength parameter and is memcpy'd, so it might not be null terminated (which is a requirement for CStringPointer).

The same for BeginRequest in HttpRequestImpl where it gets passed to.

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ namespace FFXIVClientStructs.FFXIV.Client.SupportDesk;
[Inherits<HttpConnection>]
[StructLayout(LayoutKind.Explicit, Size = 0x10)]
public unsafe partial struct HttpConnectionImpl {
[FieldOffset(0x008)] void* SessionHandle; // HINTERNET
[FieldOffset(0x008)] public void* SessionHandle; // HINTERNET
}
8 changes: 8 additions & 0 deletions FFXIVClientStructs/FFXIV/Client/SupportDesk/HttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ namespace FFXIVClientStructs.FFXIV.Client.SupportDesk;
public unsafe partial struct HttpRequest {
[VirtualFunction(0)]
public partial HttpRequest* Dtor(byte freeFlags);

/// <summary> Updates various bits based on the current stage. </summary>
[VirtualFunction(1)]
public partial bool Update();

/// <summary> Cleans up the open handle. </summary>
[VirtualFunction(2)]
public partial bool CloseHandle();
}
56 changes: 50 additions & 6 deletions FFXIVClientStructs/FFXIV/Client/SupportDesk/HttpRequestImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,54 @@ namespace FFXIVClientStructs.FFXIV.Client.SupportDesk;
[Inherits<HttpRequest>]
[StructLayout(LayoutKind.Explicit, Size = 0x8C8)]
public unsafe partial struct HttpRequestImpl {
[FieldOffset(0x010)] void* RequestHandle; // HINTERNET
[FieldOffset(0x018)] void* ResponseData;
[FieldOffset(0x020)] void* ResponseDataOffset;
[FieldOffset(0x028)] void* ResponseDataSize;
[FieldOffset(0x470)] void* OptionalData;
[FieldOffset(0x480)] int Stage;
[FieldOffset(0x010)] public void* RequestHandle; // HINTERNET
[FieldOffset(0x018)] public byte* ResponseData;
[FieldOffset(0x020)] public long ResponseDataOffset;
[FieldOffset(0x028)] public ulong ResponseDataSize;
[FieldOffset(0x470)] public byte* OptionalData;
[FieldOffset(0x480)] public HttpRequestStage Stage;
[FieldOffset(0x48C)] public int StatusCode;
/// <remarks> Increased by Framework.FrameDeltaTime every time Update is called. </remarks>
[FieldOffset(0x8C0)] public float FrameDeltaTimeCounter;

/// <summary> Initializes and begins this request. </summary>
/// <param name="sessionHandle">The HINTERNET handle to use.</param>
/// <param name="url">URL to make a request to.</param>
/// <param name="verb">The HTTP verb, such as "GET" or "POST".</param>
/// <param name="data">Any request data to send (only relevant for POST requests really).</param>
/// <param name="dataLength">Length of the data buffer.</param>
/// <returns>Whether the request was successfully sent.</returns>
[MemberFunction("E8 ?? ?? ?? ?? 84 C0 75 ?? 48 8B 03 BA ?? ?? ?? ?? 48 8B CB FF 10 33 DB")]
public partial bool BeginRequest(void* sessionHandle, byte* url, byte* verb, byte* data, ulong dataLength);

/// <summary> Used as the WinHttp status callback. </summary>
/// <remarks> Documentation for this callback can be found <a href="https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nc-winhttp-winhttp_status_callback">here</a>. </remarks>
[MemberFunction("48 85 D2 0F 84 ?? ?? ?? ?? 48 89 5C 24 ?? 56 57")]
public static partial void StatusCallback(void* requestHandle, HttpRequestImpl* context, uint internetStatus, void* statusInformation, uint statusInformationLength);
}

public enum HttpRequestStage {
Unk0 = 0,
/// <remarks> Set during BeginRequest. </remarks>
Began = 1,
/// <remarks> Used while and shortly after fetching the ContentLength and StatusCode headers from the response. </remarks>
ReadingHeaders = 2,
/// <remarks> Used while reading the response data. </remarks>
ReadingData = 3,
/// <remarks> Seen after FetchingData, and there's nothing more to read. </remarks>
ReadAllData = 4,
Unk5 = 5,
Unk6 = 6,
/// <remarks> Set for WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING. </remarks>
Closing = 7,
/// <remarks> Set when the StatusCode is not 200 OK. Can also happen when WinHttpSendRequest is unsuccessful. </remarks>
NotOk = 8,
Unk9 = 9,
Unk10 = 10,
Unk11 = 11,
Unk12 = 12,
Unk13 = 13,
/// <remarks> Set for WINHTTP_CALLBACK_STATUS_SECURE_FAILURE. </remarks>
SecureFailure = 14,
}

6 changes: 5 additions & 1 deletion ida/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ functions:
0x141C17880: lua_gethookmask
0x141C17A70: lua_sethook
0x141C17AA0: lua_setlocal
0x141CF2790: SupportDeskHttpCallback
0x141C59F10: SupportDeskCreateConnection
0x1418F20E0: luaL_openlibs
0x1418F22D0: luaL_addlstring
Expand Down Expand Up @@ -1013,11 +1012,14 @@ classes:
base: Client::SupportDesk::HttpConnection
funcs:
0x141CB27A0: Initialize
0x141CF2790: StatusCallback # static
Client::SupportDesk::HttpRequest:
vtbls:
- ea: 0x142493A60
vfuncs:
0: dtor
1: Update
2: CloseHandle
Client::SupportDesk::HttpRequestImpl:
vtbls:
- ea: 0x1424938C8
Expand Down Expand Up @@ -11783,6 +11785,8 @@ classes:
- ea: 0x142410618
funcs:
0x141A42DD0: ctor
vfuncs:
0: dtor
Client::UI::Misc::CharaViewPortrait:
vtbls:
- ea: 0x142198BA8
Expand Down
Loading