Implement ConcatenatePaths and MyGetFileTitle.
Modified: trunk/reactos/include/wine/setupapi.h
Modified: trunk/reactos/lib/setupapi/misc.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec

Modified: trunk/reactos/include/wine/setupapi.h
--- trunk/reactos/include/wine/setupapi.h	2005-05-21 12:21:30 UTC (rev 15454)
+++ trunk/reactos/include/wine/setupapi.h	2005-05-21 12:23:07 UTC (rev 15455)
@@ -669,6 +669,7 @@
 VOID     WINAPI AssertFail(LPSTR, UINT, LPSTR);
 DWORD    WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
 DWORD    WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
+BOOL     WINAPI ConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
 BOOL     WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName);
 BOOL     WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName);
 PWSTR    WINAPI DuplicateString(PCWSTR lpSrc);
@@ -681,6 +682,7 @@
 BOOL     WINAPI IsUserAdmin(VOID);
 PWSTR    WINAPI MultiByteToUnicode(PCSTR lpMultiByteStr, UINT uCodePage);
 VOID     WINAPI MyFree(PVOID lpMem);
+PWSTR    WINAPI MyGetFileTitle(PCWSTR);
 PVOID    WINAPI MyMalloc(DWORD dwSize);
 PVOID    WINAPI MyRealloc(PVOID lpSrc, DWORD dwSize);
 DWORD    WINAPI OpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID *);

Modified: trunk/reactos/lib/setupapi/misc.c
--- trunk/reactos/lib/setupapi/misc.c	2005-05-21 12:21:30 UTC (rev 15454)
+++ trunk/reactos/lib/setupapi/misc.c	2005-05-21 12:23:07 UTC (rev 15455)
@@ -934,3 +934,113 @@
 
      return dwError;
 }
+
+
+/**************************************************************************
+ * MyGetFileTitle [SETUPAPI.@]
+ *
+ * Returns a pointer to the last part of a fully qualified file name.
+ *
+ * PARAMS
+ *     lpFileName [I] File name
+ *
+ * RETURNS
+ *     Pointer to a files name.
+ */
+LPWSTR WINAPI
+MyGetFileTitle(LPCWSTR lpFileName)
+{
+    LPWSTR ptr;
+    LPWSTR ret;
+    WCHAR c;
+
+    TRACE("%s\n", debugstr_w(lpFileName));
+
+    ptr = (LPWSTR)lpFileName;
+    ret = ptr;
+    while (TRUE)
+    {
+        c = *ptr;
+
+        if (c == 0)
+            break;
+
+        ptr++;
+        if (c == (WCHAR)'\\' || c == (WCHAR)'/' || c == (WCHAR)':')
+            ret = ptr;
+    }
+
+    return ret;
+}
+
+
+/**************************************************************************
+ * ConcatenatePaths [SETUPAPI.@]
+ *
+ * Concatenates two paths.
+ *
+ * PARAMS
+ *     lpPath         [I/O] Path to append path to
+ *     lpAppend       [I]   Path to append
+ *     dwBufferSize   [I]   Size of the path buffer
+ *     lpRequiredSize [O]   Required size for the concatenated path. Optional
+ *
+ * RETURNS
+ *     Success: TRUE
+ *     Failure: FALSE
+ */
+BOOL WINAPI
+ConcatenatePaths(LPWSTR lpPath,
+                 LPCWSTR lpAppend,
+                 DWORD dwBufferSize,
+                 LPDWORD lpRequiredSize)
+{
+    DWORD dwPathSize;
+    DWORD dwAppendSize;
+    DWORD dwTotalSize;
+    BOOL bBackslash = FALSE;
+
+    TRACE("%s %s %lu %p\n", debugstr_w(lpPath), debugstr_w(lpAppend),
+          dwBufferSize, lpRequiredSize);
+
+    dwPathSize = lstrlenW(lpPath);
+
+    /* Ignore trailing backslash */
+    if (lpPath[dwPathSize - 1] == (WCHAR)'\\')
+        dwPathSize--;
+
+    dwAppendSize = lstrlenW(lpAppend);
+
+    /* Does the source string have a leading backslash? */
+    if (lpAppend[0] == (WCHAR)'\\')
+    {
+        bBackslash = TRUE;
+        dwAppendSize--;
+    }
+
+    dwTotalSize = dwPathSize + dwAppendSize + 2;
+    if (lpRequiredSize != NULL)
+        *lpRequiredSize = dwTotalSize;
+
+    /* Append a backslash to the destination string */
+    if (bBackslash == FALSE)
+    {
+        if (dwPathSize < dwBufferSize)
+        {
+            lpPath[dwPathSize - 1] = (WCHAR)'\\';
+            dwPathSize++;
+        }
+    }
+
+    if (dwPathSize + dwAppendSize < dwBufferSize)
+    {
+        lstrcpynW(&lpPath[dwPathSize],
+                  lpAppend,
+                  dwAppendSize);
+    }
+
+    if (dwBufferSize >= dwTotalSize)
+        lpPath[dwTotalSize - 1] = 0;
+
+    return (dwBufferSize >= dwTotalSize);
+}

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-05-21 12:21:30 UTC (rev 15454)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-05-21 12:23:07 UTC (rev 15455)
@@ -193,7 +193,7 @@
 @ stdcall CaptureAndConvertAnsiArg(str ptr)
 @ stdcall CaptureStringArg(wstr ptr)
 @ stub CenterWindowRelativeToParent
-@ stub ConcatenatePaths
+@ stdcall ConcatenatePaths(wstr wstr long ptr)
 @ stdcall DelayedMove(wstr wstr)
 @ stub DelimStringToMultiSz
 @ stub DestroyTextFileReadBuffer
@@ -220,7 +220,7 @@
 @ stdcall MultiByteToUnicode(str long)
 @ stub MultiSzFromSearchControl
 @ stdcall MyFree(ptr)
-@ stub MyGetFileTitle
+@ stdcall MyGetFileTitle(wstr)
 @ stdcall MyMalloc(long)
 @ stdcall MyRealloc(ptr long)
 @ stdcall OpenAndMapFileForRead(wstr ptr ptr ptr ptr)
@@ -424,8 +424,8 @@
 @ stub SetupGetTargetPathW
 @ stdcall SetupInitDefaultQueueCallback(long)
 @ stdcall SetupInitDefaultQueueCallbackEx(long long long long ptr)
-@ stdcall SetupInitializeFileLogA (str long)
-@ stdcall SetupInitializeFileLogW (wstr long)
+@ stdcall SetupInitializeFileLogA(str long)
+@ stdcall SetupInitializeFileLogW(wstr long)
 @ stub SetupInstallFileA
 @ stub SetupInstallFileExA
 @ stub SetupInstallFileExW