ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

DWORD ScmSetServiceGroup ( PSERVICE  lpService,
LPCWSTR  lpGroupName 
)

Definition at line 27 of file groupdb.c.

Referenced by CreateServiceListEntry(), RChangeServiceConfigA(), RChangeServiceConfigW(), and RCreateServiceW().

{
    PLIST_ENTRY GroupEntry;
    PSERVICE_GROUP lpGroup;

    DPRINT("ScmSetServiceGroup(%S)\n", lpGroupName);

    if (lpService->lpGroup != NULL)
    {
        lpService->lpGroup->dwRefCount--;

        /* FIXME: What do we have to do when dwRefCount is 0? */
    }

    GroupEntry = GroupListHead.Flink;
    while (GroupEntry != &GroupListHead)
    {
        lpGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);

        if (!_wcsicmp(lpGroup->lpGroupName, lpGroupName))
        {
            lpService->lpGroup = lpGroup;
            return ERROR_SUCCESS;
        }

        GroupEntry = GroupEntry->Flink;
    }

    GroupEntry = UnknownGroupListHead.Flink;
    while (GroupEntry != &UnknownGroupListHead)
    {
        lpGroup = CONTAINING_RECORD(GroupEntry, SERVICE_GROUP, GroupListEntry);

        if (!_wcsicmp(lpGroup->lpGroupName, lpGroupName))
        {
            lpGroup->dwRefCount++;
            lpService->lpGroup = lpGroup;
            return ERROR_SUCCESS;
        }

        GroupEntry = GroupEntry->Flink;
    }

    lpGroup = (PSERVICE_GROUP)HeapAlloc(GetProcessHeap(),
                                        HEAP_ZERO_MEMORY,
                                        sizeof(SERVICE_GROUP) + ((wcslen(lpGroupName) + 1)* sizeof(WCHAR)));
    if (lpGroup == NULL)
        return ERROR_NOT_ENOUGH_MEMORY;

    wcscpy(lpGroup->szGroupName, lpGroupName);
    lpGroup->lpGroupName = lpGroup->szGroupName;
    lpGroup->dwRefCount = 1;
    lpService->lpGroup = lpGroup;

    InsertTailList(&UnknownGroupListHead,
                   &lpGroup->GroupListEntry);

    return ERROR_SUCCESS;
}

Generated on Sun May 27 2012 04:46:58 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.