From f09ba8ea46ba2f4e482d7cd03e8eb77f37a60663 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 14 Jun 2007 10:25:14 +0000 Subject: [PATCH] Call get_clone_info and get_clone_info_size instead of using the driver's path. More correct. Now we could remove the app_server's command to retrieve the driver's path. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21408 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/game/WindowScreen.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/kits/game/WindowScreen.cpp b/src/kits/game/WindowScreen.cpp index 437ff105f9..4f64aaad19 100644 --- a/src/kits/game/WindowScreen.cpp +++ b/src/kits/game/WindowScreen.cpp @@ -1006,23 +1006,36 @@ BWindowScreen::_InitClone() return status; } + accelerant_clone_info_size clone_info_size; + get_accelerant_clone_info clone_info; + clone_accelerant clone; + clone_info_size = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL); + clone_info = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL); + clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL); + status = B_ERROR; - clone_accelerant clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, 0); - if (clone == NULL) { + if (!clone_info_size || !clone_info || !clone) { printf("InitClone: cannot get clone hook\n"); unload_add_on(fAddonImage); fAddonImage = -1; return status; } - link.StartMessage(AS_GET_DRIVER_PATH); - link.Attach(fWorkspaceIndex); - if (link.FlushWithReply(status) == B_OK && status == B_OK) { - BString driverPath; - link.ReadString(driverPath); - status = clone((void *)driverPath.String()); + ssize_t cloneInfoSize = clone_info_size(); + void *cloneInfo = malloc(cloneInfoSize); + if (!cloneInfo) { + unload_add_on(fAddonImage); + fAddonImage = -1; + return B_NO_MEMORY; } + + clone_info(cloneInfo); + // no way to see if this call fails + + status = clone(cloneInfo); + free(cloneInfo); + if (status < B_OK) { printf("InitClone: cannot clone accelerant\n"); unload_add_on(fAddonImage);