File:  [WindowsNT SDKs] / ntddk / src / print / lib / wsz2heap.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 18:31:12 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: ntddk-nov-1993, HEAD
Microsoft Windows NT Build 511 (DDK SDK) 11-01-1993

/***************************** Module Header *******************************
 * str2heap.c
 *      Function to add a string to the heap storage.  Requires the string
 *      and the heap handle;  returns the address where the string is
 *      placed. The string is WIDE!!
 *
 * RETURNS:
 *      The address to where the string has been copied,  or 0 if the
 *      heap allocation fails.
 *
 * HISTORY:
 *  11:28 on Wed 26 Feb 1992    -by-    Lindsay Harris   [lindsayh]
 *      Copied from str2heap.c & converted.
 *
 * Copyright (C) 1990 - 1993 Microsoft Corporation
 *
 *************************************************************************/

#include        <string.h>
#include        <stddef.h>
#include        <windows.h>
#include        "libproto.h"


PWSTR
WstrToHeap( hheap, pwstr )
HANDLE   hheap;         /* The heap's handle */
PWSTR    pwstr;         /* Wide string to use */
{
    /*
     *    Size the string,  request heap space then copy string to it.
     */

    int      cStr;
    PWSTR   pwstrRet;


    cStr = sizeof( WCHAR) * (wcslen( pwstr ) + 1);      /* Plus null! */

    if( pwstrRet = (PWSTR)HeapAlloc( hheap, 0, cStr ) )
        memcpy( pwstrRet, pwstr, cStr );


    return  pwstrRet;

}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.