Source file: /~heha/mb-iwp/USB-1210/1210-201023.zip/src/1210.cpp

#include "1210.h"

TCHAR MBoxTitle[64];
HINSTANCE hInstance;

int vMBox(HWND wnd, UINT id, UINT type, va_list va) {
  TCHAR s[256],t[256];
  LoadString(hInstance,id,t,elemof(t));
  s[_vsntprintf(s,elemof(s)-1,t,va)]=0;
  return MessageBox(wnd,s,MBoxTitle,type);
}

int _cdecl MBox(HWND wnd, UINT id, UINT type, ...) {
  va_list va;
  va_start(va,type);
  int ret=vMBox(wnd,id,type,va);
  va_end(va);
  return ret;
}

extern "C" void CALLBACK WinMainCRTStartup() {
  hInstance=GetModuleHandle(0);
  INITCOMMONCONTROLSEX icc={sizeof icc,ICC_WIN95_CLASSES};
  InitCommonControlsEx(&icc);

  if (CardSel(0)) {
    I16 hCard=UD_Register_Card(USB_1210,nCardID);
    if (hCard<0) {
      MBox(0,2,MB_OK,hCard);
    }else{
      DialogBox(hInstance,MAKEINTRESOURCE(100),0,MainDlgProc);
      UD_Release_Card(hCard);
    }
  }
  ExitProcess(0);
}

extern "C" int _fltused;
int _fltused;

int popcount(unsigned x) {int r=0; do r+=x&1; while (x>>=1); return r;}
Detected encoding: ASCII (7 bit)2