Advertisement
Jailout2000

Battle.net Account Expiration Code

Jun 18th, 2012
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. // This is how classic Battle.net calculates if your account is expired or not.
  2. // Pretend that the functions that this function calls actually return real data about that account.
  3. // You could do this in a multitude of ways, such as providing the necessary data in the function parameters instead.
  4. // The end result is the same -- see the return line.
  5.  
  6. void isExpired(int databaseId)
  7. {
  8.   FILETIME today = getToday();                             // today's date and time in a FILETIME struct
  9.   FILETIME accountCreated = getAccountCreated(databaseId); // profile key: System/Account Created
  10.   FILETIME lastLogon = getLastLogon(databaseId);           // profile key: System/Last Logon
  11.   int timeLogged = getTimeLogged(datebaseId);              // profile key: System/Time Logged
  12.  
  13.   // Note that the FILETIME structure is based on 100-nanosecond intervals.
  14.   int oneSecond   = (10000000);
  15.   int twoHours    = (oneSecond * 60 * 60 * 2);
  16.   int twoDays     = (oneSecond * 60 * 60 * 24 * 2);
  17.   int threeMonths = (oneSecond * 60 * 60 * 24 * 90);
  18.  
  19.   // Note that I am not paying attention whether I can add int to FILETIME, that is up to how you code this yourself.
  20.   // This is only a concept demonstration of how the code could look like.
  21.  
  22.   return (accountCreated + twoHours < today && (timeLogged < twoDays || lastLogon + threeMonths < today));
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement