Changed LdrLoadDll to only search for the dll in the specified path,
[wine/multimedia.git] / memory / string.c
blob7102e604d72fad841223011466e38bd7df47c51b
1 /*
2 * String functions
4 * Copyright 1993 Yngvi Sigurjonsson
5 * Copyright 1996 Alexandre Julliard
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <ctype.h>
23 #include <stdarg.h>
24 #include <string.h>
26 #include "ntstatus.h"
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wine/winbase16.h"
30 #include "wine/exception.h"
31 #include "wine/unicode.h"
32 #include "winerror.h"
33 #include "winnls.h"
34 #include "excpt.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(string);
39 /***********************************************************************
40 * lstrcpyn (KERNEL32.@)
41 * lstrcpynA (KERNEL32.@)
43 * Note: this function differs from the UNIX strncpy, it _always_ writes
44 * a terminating \0.
46 * Note: n is an INT but Windows treats it as unsigned, and will happily
47 * copy a gazillion chars if n is negative.
49 LPSTR WINAPI lstrcpynA( LPSTR dst, LPCSTR src, INT n )
51 LPSTR p = dst;
52 UINT count = n;
54 TRACE("(%p, %s, %i)\n", dst, debugstr_a(src), n);
56 /* In real windows the whole function is protected by an exception handler
57 * that returns ERROR_INVALID_PARAMETER on faulty parameters
58 * We currently just check for NULL.
60 if (!dst || !src) {
61 SetLastError(ERROR_INVALID_PARAMETER);
62 return 0;
64 while ((count > 1) && *src)
66 count--;
67 *p++ = *src++;
69 if (count) *p = 0;
70 return dst;
74 /***********************************************************************
75 * lstrcpynW (KERNEL32.@)
77 * Note: this function differs from the UNIX strncpy, it _always_ writes
78 * a terminating \0
80 * Note: n is an INT but Windows treats it as unsigned, and will happily
81 * copy a gazillion chars if n is negative.
83 LPWSTR WINAPI lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
85 LPWSTR p = dst;
86 UINT count = n;
88 TRACE("(%p, %s, %i)\n", dst, debugstr_w(src), n);
90 /* In real windows the whole function is protected by an exception handler
91 * that returns ERROR_INVALID_PARAMETER on faulty parameters
92 * We currently just check for NULL.
94 if (!dst || !src) {
95 SetLastError(ERROR_INVALID_PARAMETER);
96 return 0;
98 while ((count > 1) && *src)
100 count--;
101 *p++ = *src++;
103 if (count) *p = 0;
104 return dst;