Hi.

In unit synamisc.pas there is a procedure WakeOnLan(MAC, IP: string);

However when this code is used on Unicode version of Delphi (like since
D2009), it can send incorrect Magic Packets, due to WideChar->AnsiChar
conversion.

Problem is with this line in WakeOnLan procedure:
      HexMac := HexMac + *char*(b);

On Delphi Unicode, Char is an alias to WideChar, so if "b" will be > 127,
then you can get incorrect results. For example if you send WOL to MAC:
0800277a*93f5*
then output packet will be with MAC 0800277a*3f6f*
because WideChar($*93*) will be converted to AnsiChar($*3f*) (it's a '?'
char, because that WideChar cannot be converted to AnsiChar).

Simple fix is to change Char(b) to AnsiChar(b) like:

      HexMac := HexMac + AnsiChar(b);


Regards,
Krystian Bigaj
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to