home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,425 of 10,840   
   Antony Clements to J French   
   Re: a problem with copymem API   
   17 Feb 07 23:38:01   
   
   From: antony.clements@optusnet.com.au   
      
   i am grabbing two 4 byte strings and placing them in a long one ascii code   
   at a time since i can't get any dynamic values any other way. this means   
   that both inputs are between 000 and 255255255 or three bytes of data. these   
   values will fit into a long. the end goal is to have a sub where i can   
   manipulate how many bytes are taken and converted into their respective   
   ascii codes, or a decimal value of the string. either is acceptable but i   
   think that things will work better with the ascii codes as placing a byte   
   array in a long returns a static value regardless of what is actually in the   
   byte array.   
      
   for an effective encryption sequence both strings need to be at least 4   
   bytes, for this reason i am using a double instead because it can fit the   
   ascii codes of 4 characters in it. these strings must be turrned into a   
   value so they can be XOR'd together. the result of this is then XOR'd with a   
   random value, the result of this is then XOR'd with the ascii code of the   
   byte of the file that is being encrypted and then mod 256. taking 4 bytes   
   from each will on occasion throw up an overflow error in a double data type   
   and will not work at all with a long. if you still don't understand what i   
   am trying to do then i will be happy to post the block of code so you can   
   see exactly what it is doing and where it is not working.   
      
   "J French"  wrote in message   
   news:45d6e3d5.10071634@news.btopenworld.com...   
   > On Sat, 17 Feb 2007 21:42:28 +1100, "Antony Clements"   
   >  wrote:   
   >   
   >>you would be correct mr French. i have tried everything i know before i   
   >>came   
   >>to ask for help, including everything that mr earley suggested, they all   
   >>work some occasions and throw up overflow errors on other occasions.   
   >>   
   >>what i really need is work around so that no error occurs at all. the only   
   >>way to do this is to only take three characters at a time and this is not   
   >>acceptable in the long term. using CopyMemory in the way you just   
   >>suggested   
   >>as it will throw up an error unless the long is unsigned. i know there is   
   >>a   
   >>way in which to allow for an unsigned variable, but i'm not sure how this   
   >>is   
   >>achieved.   
   >   
   > I've been using CopyMemory for years with any old data, what happens   
   > is the 'string' is converted to four ANSI characters and then shoved   
   > into the Long.  The sign does not matter a jot.   
   >   
   > As I mentioned earlier this is dangerous in MBCS Locales as 8 bytes of   
   > Unicode could convert into eight bytes of ANSI instead of four bytes.   
   >   
   > I think that you are running into another problem.   
   >   
   > Best you describe what you want to send in to a function and then what   
   > you want to get out.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca