Page 1 of 1

applet component

Posted: Fri Apr 15, 2016 1:45 am
by lenosrd
In JCVM v3.0.4 Classic Edition, the applet component is described as

applet_component {
u1 tag
u2 size
u1 count
{ u1 AID_length
u1 AID[AID_length]
u2 install_method_offset
} applets[count]
}


As we can see, the applet AID is present in applet component. But how can I get these instances of the structure in the my programming? Or some information about applet?
How can I find out the root applet?

Re: applet component

Posted: Fri Apr 15, 2016 3:36 am
by Liguwu
FYI

Code: Select all

struct AppletInfo{
     char AID_length;
     char AID[]; //size = AID_length
};

struct AppletComponent{
  char Tag;
  short int Size;
  char Count;
  AppletInfo Applets[];
};

AppletInfo* NextApplet(AppletInfo* Applet){
  return (AppletInfo*)&Applet->AID[Applet->AID_length];
}


int _tmain(int argc, _TCHAR* argv[])
{
   AppletComponent * aplComp;
   //.....
   AppletInfo *Applet = &aplComp->Applets[0];
   //to get the next call applet, but not more than Count-1 {-1 because the first one we've already got}
   Applet = NextApplet(Applet);
   return 0;
}


Re: applet component

Posted: Fri Apr 15, 2016 5:57 am
by Crawford
There is no root applet. Each applet is just packaged in a flat way inside the CAP file as if they were just different classes.

Re: applet component

Posted: Sat Apr 16, 2016 3:29 am
by Pf6KINE

Code: Select all

PAppletInfo = ^TAppletInfo;
  TAppletInfo = packed record
  private
    function GetInstallMethodOffset: TShort;
  public
    AID_length: Byte;
    AID: Array[0..0] of byte; //size = AID_length
    (*
    InstallMethodOffset: Word;
    *)
    property InstallMethodOffset: TShort read GetInstallMethodOffset;
  end;

  PAppletComponent = ^TAppletComponent;
  TAppletComponent = packed record
    Tag: TComponentType;
    Size: TShort;
    Count: Byte;
    Applets: Array[0..0] of TAppletInfo;  //size = Count
  end;

function TAppletInfo.GetInstallMethodOffset: TShort;
begin
  Result := PWord(@AID[AID_length])^;
end;