The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: abitlater on January 07, 2008, 09:50:29 PM

Title: string safe functions
Post by: abitlater on January 07, 2008, 09:50:29 PM
is there an include file and library for safe string functions, like strsafe.lib, somewhere?  I don't see this in my MASM32 library

Thanks
aBitLater
Title: Re: string safe functions
Post by: Vortex on January 07, 2008, 09:59:15 PM
strsafe.h and strsafe.lib are the components of PSDK. I guess this is why the Masm32 package does not include them. ( More precisely, strsafe.lib is a MS static library.)
Title: Re: string safe functions
Post by: GregL on January 08, 2008, 02:25:59 AM
abitlater,

Here is an include file I started. I never got to the 'Character Count' functions.


; 'Safe String' Functions
;
; 'strsafe.h' and 'strsafe.lib' are in the Platform SDK
;
; All functions are STDCALL except
; StringCbPrintfA due to :VARARG
;
; Greg Lyon - March 2005
;
;
; 'Byte Count' Functions
;
; Tested and working
;
StringCbCatA        PROTO :PTR BYTE, :DWORD, :PTR BYTE
StringCbCat         EQU <StringCbCatA>

StringCbCopyA       PROTO :PTR BYTE, :DWORD, :PTR BYTE
StringCbCopy        EQU <StringCbCopyA>

StringCbLengthA     PROTO :PTR BYTE, :DWORD, :DWORD
StringCbLength      EQU <StringCbLengthA>

StringCbPrintfA     PROTO C :PTR BYTE, :DWORD, :PTR BYTE, :VARARG
StringCbPrintf      EQU <StringCbPrintfA>


; Not tested
;
;StringCbCatNA       PROTO :PTR BYTE, :DWORD, :PTR BYTE, :DWORD
;StringCbCatN        EQU <StringCbCatNA>
;
;StringCopyNA        PROTO :PTR BYTE, :DWORD, :PTR BYTE, :DWORD
;StringCbCopyN       EQU <StringCopyNA>
;
;StringCbVPrintfA    PROTO :PTR BYTE, :DWORD, :PTR BYTE, :PTR BYTE
;StringCbVPrintf     EQU <StringCbVPrintfA>


Title: Re: string safe functions
Post by: ToutEnMasm on January 08, 2008, 01:52:53 PM
Hello,
All you need is here
http://www.masm32.com/board/index.php?topic=8022.msg59040#msg59040
Title: Re: string safe functions
Post by: abitlater on February 08, 2008, 12:23:57 AM
Quote from: ToutEnMasm on January 08, 2008, 01:52:53 PM
Hello,
All you need is here
http://www.masm32.com/board/index.php?topic=8022.msg59040#msg59040

many thanks!
Title: Re: string safe functions
Post by: askm on April 13, 2010, 03:08:51 AM
Cannot compile a strsafe example with function such as StringCbCopyA:

______snip_________
.586
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc

include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\msvcrt.inc
include \masm32\strsafe\strsafe.inc from forementioned
include \masm32\include\masm32.inc
include \masm32\macros\macros.asm

includelib \masm32\lib\user32.lib
includelib \masm32\strsafe\strsafe.lib from sdk
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\msvcrt.lib
includelib \masm32\lib\masm32.lib
______snip_________

...

Are these the proper prereqs more or less ?
Title: Re: string safe functions
Post by: Vortex on May 28, 2010, 06:58:44 PM
Hi askm,

What's the error message you are receiving?