Bugfix: When returning a string SysAllocStringByteLen() must be used so programming languages such as Visual Basic does not crash.

This commit is contained in:
Micke Prag 2008-03-02 11:07:07 +00:00
parent 37ba12675b
commit 269393cf04

View file

@ -142,6 +142,7 @@ char * WINAPI devGetName(int intDeviceId){
try{ try{
TelldusSettings ts; TelldusSettings ts;
strReturn = ts.getName(intDeviceId); strReturn = ts.getName(intDeviceId);
strReturn = (char *)SysAllocStringByteLen (strReturn, lstrlen(strReturn));
} }
catch(exception e){ catch(exception e){
strReturn = ""; strReturn = "";
@ -168,6 +169,7 @@ char* WINAPI devGetVendor(int intDeviceId){
try{ try{
TelldusSettings ts; TelldusSettings ts;
strReturn = ts.getVendor(intDeviceId); strReturn = ts.getVendor(intDeviceId);
strReturn = (char *)SysAllocStringByteLen (strReturn, lstrlen(strReturn));
} }
catch(exception e){ catch(exception e){
strReturn = ""; strReturn = "";
@ -194,6 +196,7 @@ bool WINAPI devSetVendor(int intDeviceId, char* strVendor){
try{ try{
TelldusSettings ts; TelldusSettings ts;
strReturn = ts.getModel(intDeviceId); strReturn = ts.getModel(intDeviceId);
strReturn = (char *)SysAllocStringByteLen (strReturn, lstrlen(strReturn));
} }
catch(exception e){ catch(exception e){
strReturn = ""; strReturn = "";