Now that's really annoying, I'm on the SE network all the time, why can't I get some sort of notification that some code snippet that I'd like to have gone back to is likely to disappear forever?

It was a question about using strange code constructs or something to that effect and I had an answer where a guy returned the session ID using delphi assembly and I'd like to know how he did it, any chance someone could resurrect that answer for me, at least so I can see if it's a good idea?


1 Answer 1


On a second look, it looks like What's your best unnecessary code?, from October 2010, is it:

function GetCurrentSessionId: DWORD;
  mov     eax,fs:[$00000018];   // Get TEB
  mov     eax,[eax+$30];        // PPEB
  mov     eax,[eax+$1d4];       // PEB.SessionId

Normally, however, you'd want to get 10k reputation to see deleted posts.

  • That was it thanks for checking, I'm pretty sure it was that one it was assembly code which you can write inline in Delphi, not in pascal. Anyway, I found getSystemMetrics($1000) <> 0 which does the same thing (and [probably] works on the 64-bit compiler). Jan 10, 2012 at 16:43
  • @PeterTurner Ah, I see it now: updated my answer.
    – user8
    Jan 10, 2012 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .