Hello Perlmonks community!

My name is Peter, i just signed up and posting the first time to seek the wisdom of the perkmonks community...

im not a novice perl coder, but today i got some ad code snippet of my company which i need to include into my application.

They send me the code in "C" , it is short and easy to readout... i tried the whole day but i wasnt successfull converting this code to Perl - since im not that familar with dwords and getdriveinformations!

This is what the complete "C" snipped code of it looks like:


char drivenamestr[32]; strcpy(drivenamestr, "C:\\"); DWORD sn=0, ignored1, ignored2; for (int drivename='C'; drivename<='Z'; drivename++) { drivenamestr[0]=drivename; if (GetVolumeInformation(drivenamestr, 0, 0, &sn, &ignored1, &ign +ored2,0, 0)) break; }; if (!sn) sn=0xE16E; sn^=0x35AF; srand(sn); volatile DWORD r32=0; for (int i=0; i<11; i++) { r32<<=15; r32|=rand(); }; DWORD generated_check=(rand()<<16) | rand(); char gcheck[64]; sprintf(gcheck, "%x", generated_check);


Many thx on any help - Help really appreciated...

Thanks!!

Yours, Peter.

In reply to A little C code converted to Perl *HELP* by regnab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.