Jump to content

Search the Community

Showing results for tags 'srand msvcrt'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I'm trying to call the srand function in the msvcrt.dll. It is defined as void srand( unsigned int seed ); My sample code is: Local $aResult Local $h_DLL = DllOpen("msvcrt.dll") If $h_DLL <> -1 Then     Local $uint = DllStructCreate("uint")     DllStructSetData($uint, 1, 54321)     ConsoleWrite('@@'  & @ScriptLineNumber & ' uint[' & DllStructGetSize($uint) & ']:' & DllStructGetData($uint, 1) & @CRLF)     $aResult = DllCall($h_DLL, "none", "srand", "int", $uint)     ConsoleWrite('@@'  & @ScriptLineNumber & ' srand done' & @CRLF)     If @error Then         ConsoleWrite('@@'  & @ScriptLineNumber & ' srand Error:' & @error & @CRLF)     EndIf Else     ConsoleWrite('@@'  & @ScriptLineNumber & ' srand DLL Error' & @CRLF) EndIf When I run it I get: >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\AutoIt3\PasswordTool\Tweaks\srand.au3"     --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop @@7 uint[4]:54321 !>15:15:08 AutoIt3.exe ended.rc:-1073741819 +>15:15:08 AutoIt3Wrapper Finished. >Exit code: 3221225477    Time: 0.6205 Which indicates an Access violation. Using windbg, I can see in the assembly that it is trying to do a PTR on a 0x00 value. Searching the web, I found a reference to what the srand routine is trying to do:   void __cdecl srand (unsigned int seed) { _getptd()->_holdrand = (unsigned long)seed; } int __cdecl rand (void) { _ptiddata ptd = _getptd(); return ( ((ptd->_holdrand = ptd->_holdrand * 214013L + 2531011L) >> 16) & 0x7fff ); } Do I need to do something to the msvcrt.dll library before it can reference any global pointers. I'm assuming that _getptd() must reference some global pointer?
×
×
  • Create New...