I've seen this question which says __PAIR__
macro does some conditional computation. But I can not relate that with standard I/O handles. Here is the pseudocode in IDA:
if ( (char *)hConout - 1 <= (char *)0xFFFFFFFFFFFFFFFDi64 ) {
ConfigureStdHandles((PHANDLE)handle);
v175 = __PAIR__(1, (unsigned int)handle[0]);
v176 = __PAIR__(2, (unsigned int)handle[1]);
v177 = __PAIR__(2, (unsigned int)handle[2]);
Here is the corresponding Assembly:
loc_1400088CA: ; CODE XREF: wmain+FBF↑j
mov [rsp+418h+handle+18h], rsi
lea rax, [rsi-1]
cmp rax, 0FFFFFFFFFFFFFFFDh
setbe al
mov rcx, [rsp+418h]
test al, al
jz loc_140008BAD
lea rcx, [rsp+418h+handle] ; hIn
call _ConfigureStdHandles
mov esi, 1
mov dword ptr [rsp+418h+var_268+4], esi
mov eax, dword ptr [rsp+418h+handle]
mov dword ptr [rsp+418h+var_268], eax
mov dword ptr [rsp+418h+var_260+4], 2
mov eax, dword ptr [rsp+418h+handle+8]
mov dword ptr [rsp+418h+var_260], eax
mov dword ptr [rsp+418h+var_258+4], 2
mov eax, dword ptr [rsp+418h+handle+10h]
mov dword ptr [rsp+418h+var_258], eax
cmp [rsp+418h+var_230], r15b
jz short loc_140008958
mov [rsp+418h+var_268], r15
loc_140008958:
The handles are for standard input, output and error respectively. Can you explain what does the __PAIR__
macro do with those handles?